Bug #75555 [Opn->Nab]: Memory leak in array

From: Date: Sat, 16 Dec 2017 21:15:11 +0000
Subject: Bug #75555 [Opn->Nab]: Memory leak in array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213137@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75555&edit=1 ID: 75555 Updated by: nikic@php.net Reported by: invader22 at yandex dot ru Summary: Memory leak in array -Status: Open +Status: Not a bug Type: Bug Package: Arrays related Operating System: Linux, Ubuntu 16.04 PHP Version: 7.0.25 Block user comment: N Private report: N New Comment: The memory manager caches allocated blocks. You can run gc_mem_caches() to reclaim them. Unless you are specifically interested in investigating allocator caching behavior, do not pass true to memory_get_usage(). Previous Comments: ------------------------------------------------------------------------ [2017-11-22 20:21:53] invader22 at yandex dot ru Description: ------------ * memory leak in version 7.0+ (7.0.22 from repository ubuntu 16.04; 7.1.5 from sources, minimal configuration) Test script: --------------- $a = array(); for ($j = 1; $j <= 3; $j++) { for ($i = 0; $i < 50000; $i++) { $a[] = range(0, 10); } echo "Memory: ", (memory_get_usage(true) / 1024), " KiB\n"; $a = null; unset($a); $a = array(); echo "Memory: ", (memory_get_usage(true) / 1024), " KiB\n"; } Expected result: ---------------- Memory: 92160 KiB Memory: 768 KiB Memory: 92160 KiB Memory: 768 KiB Memory: 92160 KiB Memory: 768 KiB Actual result: -------------- Memory: 36868 KiB Memory: 34816 KiB Memory: 36868 KiB Memory: 34816 KiB Memory: 36868 KiB Memory: 34816 KiB ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75555&edit=1

« previous php.bugs (#213137) next »