Edit report at https://bugs.php.net/bug.php?id=60983&edit=1
ID: 60983 Comment by: DeveloperGuy2008 at yahoo dot com Reported by: developerguy2008 at yahoo dot com Summary: Memory is not properly freed Status: Not a bug Type: Bug Package: Scripting Engine problem Operating System: all PHP Version: 5.4.0RC7 Block user comment: N Private report: N New Comment: Do you know any references where I may read about the object_store? Is there a to shrink it (like a compile time flag) when it is does not need to be large? It seems like the ideal result would be to shrink the object store. In this example it is only a few megabytes but in other cases it could be several hundred megabytes that essentially lost forever (at least to other processes). Previous Comments: ------------------------------------------------------------------------ [2012-02-06 07:46:59] larue...@php.net the reason for there is mem diff is that, the EG(objects_store) could only be grow but could not be shrunk. if you tweak your test into: $mem1 = memory_get_usage(true); echo "MEM1: " . $mem1 . "\n"; class A { public $class; } $c1 = $c2 = null; for ($i = 0; $i < 20000; $i++) { $c1 = new A(); $c2 = new A(); $c1->class = array($c1, $c2); $c2->class = array($c1, $c2); gc_collect_cycles(); } unset($c1); unset($c2); $mem2 = memory_get_usage(true); echo "MEM2: " . $mem2 . "\n"; echo "DIFF: " . ($mem2 - $mem1) . "\n"; you may understand my point ------------------------------------------------------------------------ [2012-02-06 00:43:46] developerguy2008 at yahoo dot com Description: ------------ Memory is not being freed properly. In a short loop several megabytes are lost that should not be lost. Attached is a test script to demonstrate what I mean. Test script: --------------- $mem1 = memory_get_usage(true); echo "MEM1: " . $mem1 . "\n"; class A { public $class; } $c1 = $c2 = null; for ($i = 0; $i < 20000; $i++) { $c1 = new A(); $c2 = new A(); $c1->class = array($c1, $c2); $c2->class = array($c1, $c2); } unset($c1); unset($c2); gc_collect_cycles(); $mem2 = memory_get_usage(true); echo "MEM2: " . $mem2 . "\n"; echo "DIFF: " . ($mem2 - $mem1) . "\n"; Expected result: ---------------- I expect the memory difference to be 0. In this case it is several megabytes. Actual result: -------------- MEM1: 4980736 MEM2: 7340032 DIFF: 2359296 The DIFF should be 0. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60983&edit=1