Req #14263 [Opn->Wfx]: Don't free each allocation during shutdown

From: Date: Tue, 17 Feb 2015 09:18:35 +0000
Subject: Req #14263 [Opn->Wfx]: Don't free each allocation during shutdown
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190738@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=14263&edit=1 ID: 14263 Updated by: krakjoe@php.net Reported by: samjam@php.net Summary: Don't free each allocation during shutdown -Status: Open +Status: Wont fix Type: Feature/Change Request Package: CGI/CLI related Operating System: * PHP Version: * Block user comment: N Private report: N New Comment: This is simply not feasible today. I can be wrong, but even so this kind of change would require an RFC. I'm going to mark the bug as won't fix, this report can still be found by any future RFC. Previous Comments: ------------------------------------------------------------------------ [2001-11-28 04:01:41] derick@php.net Making it a feature request, as it's not a "bug". ------------------------------------------------------------------------ [2001-11-28 04:00:08] samjam@php.net If compiled in standalone cgi mode, when the script exits, php only needs to free resources, not other arrays or strings or items (unless we ever support object destructors). It can take a LONG time to free a hundred thousand or so elements in nested arrays, 4 or 5 times longer than it takes to create then. See these threads in phpdev mailing list: Re: [PHP-DEV] maybe serious error in RC3 memory manager RE: [PHP-DEV] CGI quick cleanup Sample code: Note how long it takes to exit after finishing. #! /usr/bin/php -q <?php ini_Set("max_execution_time","0"); ini_Set("memory_limit","500M"); class thingy { function thingy($c) { if ($c>0) $this->ref=&new thingy($c-1); } } $stash=array(); $max=500000; $start=time(); for($i=0;$i<$max;$i++) { $r=rand(0,300); $stash[$r][]=&new thingy(rand(0,10)); echo "\rUse: ".floor($i/$max*100)."% "; } echo "\n"; $mid=time(); $max=count($stash); $c=0; foreach(array_keys($stash) as $key) { unset($stash[$key]); $c++; echo "\rFree: ".floor($c/$max*100)."% "; } unset($stash); echo "\n"; $done=time(); print "Use: ".($mid-$start)."\n"; print "Free: ".($done-$mid)."\n"; ?> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=14263&edit=1

« previous php.bugs (#190738) next »