Bug #61785 [Opn->Csd]: Memory leak when access a non-exists file without router
Edit report at https://bugs.php.net/bug.php?id=61785&edit=1
ID: 61785
Updated by: laruence@php.net
Reported by: reeze dot xia at gmail dot com
Summary: Memory leak when access a non-exists file without
router
-Status: Open
+Status: Closed
Type: Bug
Package: Built-in web server
Operating System: ANY
PHP Version: 5.4.0
-Assigned To:
+Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
fixed in : http://git.php.net/?p=php-
src.git;a=commit;h=cc58373d4d9b0b3d8b0e2cbf86dfee37da799c77
Previous Comments:
------------------------------------------------------------------------
[2012-04-20 09:53:31] reeze dot xia at gmail dot com
Hi,
I've attached a patch for this. and I fixe a typo in similar mem leak fix's
test.
@see https://github.com/php/php-src/pull/64
Thanks.
------------------------------------------------------------------------
[2012-04-20 09:36:49] reeze dot xia at gmail dot com
Description:
------------
When access a non exists file in builtin web server. with --enable-debug it report
leaks.
When send error page, It call php_output_deactivate() it disabled the sent_headers
callback but it will emalloc default_content-type. then it leaks.
So I think set SG(sapi_headers).send_default_content_type to 0 temporary can avoid
leaking.
Test script:
---------------
NONE
Expected result:
----------------
no leaks
Actual result:
--------------
PHP 5.4.1RC1-dev Development Server started at Fri Apr 20 17:23:52 2012
Listening on localhost:9999
Document root is /Users/reeze/Opensource/php-src
Press Ctrl-C to quit.
[Fri Apr 20 17:24:05 2012] ::1:56664 [404]: /no-exist.png - No such file or
directory
[Fri Apr 20 17:24:05 2012] ::1:56665 [404]: /favicon.ico - No such file or
directory
^C[Fri Apr 20 17:24:07 2012] Script: '-'
/Users/reeze/Opensource/php-src/main/SAPI.c(839) : Freeing 0x10A6B0208 (24
bytes), script=-
[Fri Apr 20 17:24:07 2012] Script: '-'
/Users/reeze/Opensource/php-src/Zend/zend_llist.c(39) : Freeing 0x10A6B04A8 (39
bytes), script=-
[Fri Apr 20 17:24:07 2012] Script: '-'
/Users/reeze/Opensource/php-src/main/SAPI.c(321) : Freeing 0x10A6B4758 (10
bytes), script=-
=== Total 3 memory leaks detected ===
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61785&edit=1
Thread (3 messages)