Edit report at https://bugs.php.net/bug.php?id=48781&edit=1
ID: 48781 Updated by: dmi...@php.net Reported by: nate at frickenate dot com Summary: Cyclical garbage collector memory leak -Status: Assigned +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: Debian 5.0 kernel 2.6.24-23-xen PHP Version: 5.3.0 Assigned To: dmitry Block user comment: N Private report: N New Comment: As I already told before, the test case is not excellent. It measures amount of memory with one period, while the GC occurs with another one. Anyway the results donsn't grow forever. $ sapi/cli/php bug48781.php memory usage after 100,000 users: 0.82 MB. memory usage after 200,000 users: 0.83 MB. memory usage after 300,000 users: 0.85 MB. memory usage after 400,000 users: 0.86 MB. memory usage after 500,000 users: 0.88 MB. memory usage after 600,000 users: 0.89 MB. ... memory usage after 24,700,000 users: 4.40 MB. memory usage after 24,800,000 users: 4.41 MB. memory usage after 24,900,000 users: 4.43 MB. memory usage after 25,000,000 users: 0.81 MB. memory usage after 25,100,000 users: 0.82 MB. memory usage after 25,200,000 users: 0.83 MB. ... memory usage after 49,700,000 users: 4.40 MB. memory usage after 49,800,000 users: 4.42 MB. memory usage after 49,900,000 users: 4.43 MB. memory usage after 50,000,000 users: 0.81 MB. memory usage after 50,100,000 users: 0.82 MB. memory usage after 50,200,000 users: 0.84 MB. It's better to insert gc_collect_cycles() before measuring the memory usage. In this case the results would be same. So the bug is fixed. May be you suffer from another one but I can do nothing without a test case. Previous Comments: ------------------------------------------------------------------------ [2011-10-31 20:16:17] nate at frickenate dot com Confirmed, this bug has regressed. Since it was originally fixed, there are few commits to zend_execute.c where that fix was effectuated. http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3/Zend/zend_execute.c? r1=293985&r2=309342 This shows all changes to that file since the fix (inclusive). The added line at 273 was the fix for this bug. But then we see the other changes made around this fix, one of which must have caused the cyclical fix to be no longer useful. ------------------------------------------------------------------------ [2011-09-13 11:28:12] nex2hex at ya dot ru On php 5.38 (win32) this bug still exists ------------------------------------------------------------------------ [2011-04-03 02:24:23] jas at rephunter dot net I believe this bug has regressed. We only recently upgraded from 5.3.2 to 5.3.5. And now several scripts are broken that have been working for years. By adding the unset of the variable at the end of the loop as shown in the first snippet below, the problem is fixed. So I believe that the symptom has regressed, although not necessarily the cause. ------------------------------------------------------------------------ [2010-04-20 14:55:01] dmi...@php.net Note that your test and expectation are not completely correct because the actual garbage collection occurs at undefined moments of time. As result the memory usage on different iteration will be different. To avoid this ambiguity add explicit call to gc_collect_cycles() before printing memory usage. ------------------------------------------------------------------------ [2010-04-20 14:50:54] dmi...@php.net 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/. Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=48781 -- Edit this bug report at https://bugs.php.net/bug.php?id=48781&edit=1