note 28950 rejected from function.imagedestroy by nicos

From: Date: Wed, 29 Jan 2003 06:34:51 +0000
Subject: note 28950 rejected from function.imagedestroy by nicos
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-43028@lists.php.net to get a copy of this message
Whenever I use GD, this is at the top of every file: <? //NOTE: ALL IMAGE RESOURCE IDENTIFIERS MUST GO INTO $DESTROY ARRAY! //THIS SHUTDOWN FUNCTION CLEANS UP MEMORY LEAKED BY THE GD LIBRARY! register_shutdown_function("destroy_images"); function destroy_images() { foreach($GLOBALS['DESTROY'] as $IM) imagedestroy($IM); } $DESTROY=array(); ?> Then, <? $DESTROY[]=$im=imagecreate($x,$y); ?> Every time I make an image, so the shutdown function automatically cleans for up every image created through the library. Perhaps this feature could be added to PHP?

« previous php.notes (#43028) next »