Bug #15258: memory_limit does not work

From: Date: Mon, 28 Jan 2002 19:44:41 +0000
Subject: Bug #15258: memory_limit does not work
Groups: php.dev 
Request: Send a blank email to php-dev+get-78326@lists.php.net to get a copy of this message
From: hs@cybertec.at Operating system: Linux PHP version: 4.1.0 PHP Bug Type: *Graphics related Bug description: memory_limit does not work I am working with dynamic images and I have encountered the following problem: <?php include("image.php"); $image = genimage(2000000, 20000000); print "it worked"; ?> function genimage($xsize, $ysize) { $image = ImageCreate($xsize, $ysize); if (!$image) die("cannot create image<br>\n"); # painting background $white = ImageColorAllocate($image, 255, 255, 255); ImageFill($image, 1, 1, $white); return $image; } When I am running the script Apache will allocate a lot of memory even if memory_limit in php.ini is set to 8 megabytes of RAM. I guess that this is a bug because PHP does not seem to check for memory violation before allocating the memory needed by the pic. Is there a way to solve the bug or at least to get around it. Maybe the problem has to do with GD (PHP cannot check before allocating). If it is this way this should be documented. Thanks for your work, Hans -- Edit bug report at: http://bugs.php.net/?id=15258&edit=1

« previous php.dev (#78326) next »