#36016 [Asn->Csd]: [PATCH] realpath cache memleaks

From: Date: Mon, 16 Jan 2006 09:18:15 +0000
Subject: #36016 [Asn->Csd]: [PATCH] realpath cache memleaks
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-91990@lists.php.net to get a copy of this message
ID: 36016 Updated by: dmitry@php.net Reported By: nlopess@php.net -Status: Assigned +Status: Closed Bug Type: Scripting Engine problem Operating System: * PHP Version: 5CVS-2006-01-14 (CVS) Assigned To: dmitry New Comment: Fixed in CVS HEAD and PHP_5_1. Previous Comments: ------------------------------------------------------------------------ [2006-01-15 14:53:31] nlopess@php.net OK, found the problem: it was loosing the cache buckets while transversing the hash list. simpl patch: http://mega.ist.utl.pt/~ncpl/php_realpath_cache.txt it also adds some comments, which can be useful to readers ;) ------------------------------------------------------------------------ [2006-01-15 02:33:17] sniper@php.net And remove those ifdefs finally. :) ------------------------------------------------------------------------ [2006-01-15 02:24:37] tony2001@php.net Dmitry, please take a look at it. ==1216== 4032 bytes in 42 blocks are definitely lost in loss record 1 of 1 ==1216== at 0x1B9008A9: malloc (vg_replace_malloc.c:149) ==1216== by 0x813977C: realpath_cache_add (tsrm_virtual_cwd.c:330) ==1216== by 0x8138BD1: virtual_file_ex (tsrm_virtual_cwd.c:616) ==1216== by 0x8140D14: expand_filepath (fopen_wrappers.c:529) ==1216== by 0x8153BDF: _php_stream_fopen (plain_wrapper.c:855) ==1216== by 0x8153F5C: php_plain_files_stream_opener (plain_wrapper.c:941) ==1216== by 0x814F5A8: _php_stream_open_wrapper_ex (streams.c:1771) ==1216== by 0x80DF196: zif_file_get_contents (file.c:530) ==1216== by 0x819D1A3: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:192) ==1216== by 0x819FEE9: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1587) ==1216== by 0x819CE50: execute (zend_vm_execute.h:92) ==1216== by 0x818026B: zend_execute_scripts (zend.c:1101) ==1216== by 0x813C5BB: php_execute_script (main.c:1720) ==1216== by 0x81E37D1: main (php_cli.c:1081) ------------------------------------------------------------------------ [2006-01-14 23:54:47] nlopess@php.net Description: ------------ the new realpath cache has a memleak when opening many files. Reproduce code: --------------- <?php foreach(range('a','z') as $f) { foreach(range('a','z') as $g) { $file = $f.$g; touch($file); file_get_contents($file); } } ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36016&edit=1

« previous php.bugs (#91990) next »