PHP 4.0 Bug #7199 Updated: Memmory leak when calling x-httpd-php-source
| From: | Bug Database | Date: | Sat, 14 Oct 2000 04:03:28 +0000 |
| Subject: | PHP 4.0 Bug #7199 Updated: Memmory leak when calling x-httpd-php-source | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-34983@lists.php.net to get a copy of this message | ||
ID: 7199
User Update by: jason@inetgurus.net
Status: Open
Bug Type: Apache related
Description: Memmory leak when calling x-httpd-php-source
I have solved the problem and have a solution. Zend has a function already built for displaying
highlighted files, highlight_file, this is the same function called by php's
highlight_file. The sapi module ,however, does not store and reset the lexical state. Therefore, a
new state is created with every call to apache_php_module_main.
There are 2 possible solutions. One is too reqrite the sapi module to store the lexical state. The
other, the one I am going to send a patch on, is to just call the already written highlight_file
function( that way there is one location to modify when this changes. ) I will be writing to php-dev
with the fix after I update this
-Jason
Previous Comments:
---------------------------------------------------------------------------
[2000-10-13 23:40:34] jason@inetgurus.net
Well I have been stabbing at this for a really long time.
I ended up in in zend-scanner.l where I can see lex allocating the 16K block as it should, but I am
not sure how to free a block with zends internal engine. Since the sapi module calls
open_file_for_scanning, I can see why the block is allocated. I have tried calling
zend_destroy_file_handle, since php_execute_script calls it. That did clean the file_handle but not
the memmory area. I can also see the that zend_execute_scripts will recycle from already allocated
code, but of coure just calling open_file_for_scanning would bypass this and not use a cached
instance. Is there a need to clear the current op_array associated with this?
---------------------------------------------------------------------------
[2000-10-13 22:20:43] jason@inetgurus.net
bug still exists in latest cvs
---------------------------------------------------------------------------
[2000-10-13 20:53:29] andi@php.net
Can you please try the latest CVS. A memory leak was fixed.
---------------------------------------------------------------------------
[2000-10-13 20:41:17] jason@inetgurus.net
I am currently debugging php trying to find the leak. So far it appears that the memmory segment is
allocated by the function open_file_for_scanning, and that it is never cleared. I will post more as
I find more.
-Jason
---------------------------------------------------------------------------
[2000-10-13 17:28:02] jason@inetgurus.net
Verified bug on php 4.0.3/Apache 1.3.12/Redhat Linux 6.2 Intel/DSO, with the exception of memmory
growing in 4K increments.(Arch difference from sparc)
---------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view the rest of the comments,
please view the bug report online.
Full Bug description available at: http://bugs.php.net/?id=7199