php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36016 [PATCH] realpath cache memleaks
Submitted: 2006-01-14 23:54 UTC Modified: 2006-01-16 10:18 UTC
From: nlopess@php.net Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2006-01-14 (CVS) OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nlopess@php.net
New email:
PHP Version: OS:

 

 [2006-01-14 23:54 UTC] 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);
	}
}
?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-15 02:24 UTC] 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-15 02:33 UTC] sniper@php.net
And remove those ifdefs finally. :)
 [2006-01-15 14:53 UTC] 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-16 10:18 UTC] dmitry@php.net
Fixed in CVS HEAD and PHP_5_1.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC