#33487 [Asn]: Memory allocated for objects created in object methods is not released
ID: 33487 User updated by: robert dot munteanu at betbrain dot com Reported By: robert dot munteanu at betbrain dot com Status: Assigned Bug Type: Scripting Engine problem Operating System: * PHP Version: 6CVS-2005-06-27 Assigned To: dmitry New Comment: Problem persists in the latest PHP 5.1 release Before: 49200 After: 440496 Previous Comments: [2005-09-09 18:09:50] robert dot munteanu at betbrain dot com The problem persists on the latest stable release 5.0.5. Output: Before: 38984 After: 430144 Please let me know what the status is on fixing this bug ( or inneficiency ). [2005-06-27 15:29:38] [EMAIL PROTECTED] This is not really a bug, but unefficient usage of memory by zend_object_storage. It frees object buckets only on request shutdown. The test case allocates: 16384 * sizeof(zend_object_store_bucket) = 393216 bytes [2005-06-27 12:17:20] [EMAIL PROTECTED] Dmitry, is there any way to fix this..? (btw. unset() does NOT free all the memory..but that's, AFAIK, by design) [2005-06-27 11:31:02] robert dot munteanu at betbrain dot com Description: Whenever you create an object in a method, memory is not released when the method execution ends, unset() must be called manually. This becomes a problem when you have long-running scripts, which perform actions repeatedly which leads to the script running out of memory. Reproduce code: --- ?php class Tester { public function doNothing() { $res = array(); for ( $i = 0; $i 1; $i++) { $res[$i] = new StdClass; } } } $t = new Tester(); echo Before: .memory_get_usage().\n; $t-doNothing(); echo After: .memory_get_usage().\n; ? Expected result: Memory usage remains roughly the same. Actual result: -- Before: 41424 After: 432560 -- Edit this bug report at http://bugs.php.net/?id=33487edit=1
#33487 [Asn]: Memory allocated for objects created in object methods is not released
ID: 33487 User updated by: robert dot munteanu at betbrain dot com Reported By: robert dot munteanu at betbrain dot com Status: Assigned Bug Type: Scripting Engine problem Operating System: * PHP Version: 6CVS-2005-06-27 Assigned To: dmitry New Comment: The problem persists on the latest stable release 5.0.5. Output: Before: 38984 After: 430144 Please let me know what the status is on fixing this bug ( or inneficiency ). Previous Comments: [2005-06-27 15:29:38] [EMAIL PROTECTED] This is not really a bug, but unefficient usage of memory by zend_object_storage. It frees object buckets only on request shutdown. The test case allocates: 16384 * sizeof(zend_object_store_bucket) = 393216 bytes [2005-06-27 12:17:20] [EMAIL PROTECTED] Dmitry, is there any way to fix this..? (btw. unset() does NOT free all the memory..but that's, AFAIK, by design) [2005-06-27 11:31:02] robert dot munteanu at betbrain dot com Description: Whenever you create an object in a method, memory is not released when the method execution ends, unset() must be called manually. This becomes a problem when you have long-running scripts, which perform actions repeatedly which leads to the script running out of memory. Reproduce code: --- ?php class Tester { public function doNothing() { $res = array(); for ( $i = 0; $i 1; $i++) { $res[$i] = new StdClass; } } } $t = new Tester(); echo Before: .memory_get_usage().\n; $t-doNothing(); echo After: .memory_get_usage().\n; ? Expected result: Memory usage remains roughly the same. Actual result: -- Before: 41424 After: 432560 -- Edit this bug report at http://bugs.php.net/?id=33487edit=1
#33487 [NEW]: Memory allocated for objects created in object methods is not released
From: robert dot munteanu at betbrain dot com Operating system: Linux 2.6.8.1 PHP version: 5.0.4 PHP Bug Type: Scripting Engine problem Bug description: Memory allocated for objects created in object methods is not released Description: Whenever you create an object in a method, memory is not released when the method execution ends, unset() must be called manually. This becomes a problem when you have long-running scripts, which perform actions repeatedly which leads to the script running out of memory. Reproduce code: --- ?php class Tester { public function doNothing() { $res = array(); for ( $i = 0; $i 1; $i++) { $res[$i] = new StdClass; } } } $t = new Tester(); echo Before: .memory_get_usage().\n; $t-doNothing(); echo After: .memory_get_usage().\n; ? Expected result: Memory usage remains roughly the same. Actual result: -- Before: 41424 After: 432560 -- Edit bug report at http://bugs.php.net/?id=33487edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33487r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33487r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33487r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33487r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33487r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33487r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33487r=needscript Try newer version: http://bugs.php.net/fix.php?id=33487r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33487r=support Expected behavior: http://bugs.php.net/fix.php?id=33487r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33487r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33487r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33487r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33487r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33487r=dst IIS Stability: http://bugs.php.net/fix.php?id=33487r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33487r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33487r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33487r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33487r=mysqlcfg