|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-03-18 13:13 UTC] vincent at ecbar dot com
try the follow code, it works on 4.0.6 but "Segmentation fault (core dumped)" on CGI version and give no error message (and appear to keep executing the code few more times on other httpd child process too) on dynamic apache module version.
i've memory limited to 8M, and it's fine when for lopp as "$i<8000".
<?php
$file = "-----";
for ($i = 0; $i<9000 ; $i++) {
$result_array["one"][$i] = $file;
$result_array["two"][$i] = $file;
$result_array["three"][$i] = $file;
$result_array["four"][$i] = $file;
$result_array["five"][$i] = $file;
$result_array["six"][$i] = $file;
$result_array["seven"][$i] = $file;
$result_array["eight"][$i] = $file;
}
echo "done<BR>";
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 18 22:00:01 2025 UTC |
This must be refcount limitation. I see memory leak with 4.2.1-dev and 4.2.0-dev. Scripting engine problem. This problem may be suspended. It's not simple to fix. May be we should let PHP die if refcount reached it's limit. [yohgaki@dev HEAD]$ ./sapi/cli/php <?php $file = "-----"; for ($i = 0; $i<9000 ; $i++) { $result_array["one"][$i] = $file; $result_array["two"][$i] = $file; $result_array["three"][$i] = $file; $result_array["four"][$i] = $file; $result_array["five"][$i] = $file; $result_array["six"][$i] = $file; $result_array["seven"][$i] = $file; $result_array["eight"][$i] = $file; } echo "done<BR>"; ?> done<BR> [Tue Mar 19 18:41:50 2002] Script: '-' --------------------------------------- /home/yohgaki/cvs/php/HEAD/Zend/zend_execute.h(62) : Block 0x082AC068 status: Beginning: Cached (allocated on /home/yohgaki/cvs/php/HEAD/Zend/zend_execute.c:467, 12 bytes) End: OK --------------------------------------- [yohgaki@dev HEAD]$ ./sapi/cli/php -v 4.2.1-dev [yohgaki@dev HEAD]$thanks a lot, i think we get into this refcount problem by mistake. infact, we don't need to assign a single variable more than 64k times. we were trying to reproduce a memory leak bug in apache module which only occur when we upgraded to 4.1.2. we are getting core dump or memory leak problem(httpd process won't release the memory until it die) we are not yet able to reproduce it. for eg, one of the interesting case is, everything works fine except when your change a file to not writable and have the following code ... some arrays which use up to 3M .. if ( $fd = fopen($indexfile, "w")) { ... } apache process will not release the used memory anymore. if we change to if ( $fd = @fopen($indexfile, "w")) it works, if the file doesn't exist and the directory isn't writable it will works too anyway, thx for the info. we'll try to reproduce our problem when we have the time.