From: jakub at icewarp dot com Operating system: Windows (Any) PHP version: 4.3.4RC1 PHP Bug Type: Session related Bug description: General memory leak
Description: ------------ This problem is hardly to be reproduced in CGI because the module is always released after finish. So the only way to reproduce it for me is the ISAPI module. You can use some web traffic tool and simulate a 1000 web accesses to any PHP script and see the memory of the ISAPI handler leaks. I'm using my own web server engine so I found out that 1000 hits to a simple <? phpinfo(); ?> page leaks about 700kb. I started debugging and compiling my own PHP core and found out this: Having the body of the funtion like this: DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB) { return 0; } leaks no memory. So we proved it's not the web server engine that leaks (other ISAPI modules do not leak anyway). Using the most simple body like this: 2. 1. HttpExtensionProc like this does leak. DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB) { TSRMLS_FETCH(); ts_free_thread(); return 0; } Leaks the memory as discussed above. So I kept digging more. Then I found the call that actually leaks the memory is: TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count); In the function: TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id) The problem is with the return &array; Call which leaks the memory. If I remove it it does not leak. If I remove the pointer character it does not leak. So the question is why does the return call leak when passing back the pointer? I'm not a C++ guru so I can't make this out. I had to post it here because when I posted the problem to ISAPI section nobody cared. This problem has been there for the last 2 years for sure. The leak is 100% reproducable and the question is why wouldn't it leak on Linux.... Please help us here? Thank you Jakub -- Edit bug report at http://bugs.php.net/?id=25844&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25844&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25844&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=25844&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=25844&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=25844&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=25844&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=25844&r=support Expected behavior: http://bugs.php.net/fix.php?id=25844&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=25844&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=25844&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=25844&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25844&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=25844&r=dst IIS Stability: http://bugs.php.net/fix.php?id=25844&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=25844&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=25844&r=float