ID: 42565 Updated by: [EMAIL PROTECTED] Reported By: devis at lucato dot it -Status: Open +Status: Bogus Bug Type: Performance problem Operating System: Linux PHP Version: 5.2.4 New Comment:
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Thank you for your interest in PHP. Previous Comments: ------------------------------------------------------------------------ [2007-09-05 13:59:01] devis at lucato dot it Description: ------------ I'm having memory usage problems as in Bug #41053 (http://bugs.php.net/bug.php?id=41053). PHP allocates much more memory on 64 bit systems, probably using 64 bit variables to describe the array structure. The following script uses 130Mb for 2Mb of data but in production systems the situation gets worse, working with big arrays and concurrent connections the wasted memory is much more... Is there any suggestion/trick/setting useful (apart code optimizaztion, rolling back to 32 bit hardware or doubling available ram) ? Any news in PHP development about memory optimization ? Perhaps some settings to disable or reduce the internal arrays structure ? Reproduce code: --------------- <?php function getMemoryUsage() { return round(memory_get_usage() / (1024*1024), 1)." MB"; } function printMemoryUsage() { print("Memory = ".getMemoryUsage()." <br>\n"); } printMemoryUsage(); $end = 1000000; $array = array(); printMemoryUsage(); for($i = 0; $i < $end; $i++) { $array[$i] = 0; } printMemoryUsage(); ?> Expected result: ---------------- Well, I expect a better memory usage. Actual result: -------------- Running matthieu script (see below) on different systems I get this results: 32 BIT SERVER ------------- PHP 5.2.4 result is 68.9 MB PHP 4.4.4 result is 57.5 MB 64 BIT SERVER ------------- PHP 5.2.4 result is 130.2 MB PHP 4.4.4 result is 99.6 MB ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42565&edit=1