PHP内存不足 - 崩溃Apache?

Abs*_*Abs 7 php memory apache

我正在运行PHP版本5.3.0和Apache:2.2.11

当我运行消耗大量内存的PHP脚本时(我认为) - 大型循环等我的Apache Web服务器报告崩溃了?!

[Sat Jan 02 00:51:30 2010] [notice] Parent: child process exited with status 255 -- Restarting.
Run Code Online (Sandbox Code Playgroud)

我需要在某处增加记忆吗?我目前有内存设置

memory_limit = 512M 
Run Code Online (Sandbox Code Playgroud)

PHP没有抱怨这个,所以我在想其他的东西?

谢谢大家

更新

我的Windows机器在事件查看器中记录了此错误:

故障应用程序httpd.exe,版本2.2.11.0,时间戳0x493f5d44,故障模块php5ts.dll,版本5.3.0.0,时间戳0x4a4922e7,异常代码0xc0000005,故障偏移0x00083655,进程ID 0x1588,应用程序启动时间0x01ca8b46e4925f90.

更新2

有问题的脚本.我已删除了该网址.

<?php error_reporting(E_ALL);

set_time_limit(300000);

echo 'start<br>';

include_once('simple_html_dom.php');

$FileHandle = fopen('tech-statistics3.csv', 'a+') or die("can't open file");

for($i =1; $i < 101; $i ++){
 // Create DOM from URL
 $html = file_get_html("http://www.x.com/$i");

 foreach($html->find('div[class=excerpt]') as $article) {

  $item0 = $article->children(1)->children(1)->children[0]->plaintext;

  $item1 = $article->children(1)->children(1)->children[0]->plaintext;

  $item2 = $article->children(1)->children(0)->children(0)->children(0)->plaintext;

  //$item3 = $article->children(1)->children(0)->children(0)->children[1]->children(0)->next_sibling();

  $stringa = trim($item0).",".trim($item1).",".trim($item2)."\r\n";

  fwrite($FileHandle, $stringa);

  echo $stringa.'<br>';
  echo '------------>'.$i;
 }
}

fclose($FileHandle);

echo '<b>End<br>';

?>
Run Code Online (Sandbox Code Playgroud)

更新3

我正在使用PHP Simple HTML DOM Parser,我刚刚发现了这个:

http://simplehtmldom.sourceforge.net/manual_faq.htm#memory_leak

我想我应该清理内存,否则它会崩溃.现在测试.

UPDATE4

是的,这是内存泄漏!:)

Abs*_*Abs 2

Apache 由于内存泄漏而崩溃,这是由于没有关闭在 for 循环中一次又一次使用的资源以及使用递归的脚本而导致的。

感谢大家的帮助。