|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1999-06-18 15:48 UTC] sas at cvs dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 10 09:00:01 2026 UTC |
One of my (ex-)users wrote the following script, and then started calling it with larger and larger values for the x and y variables (apparently to see how high he could go before he crashed php). When he got to 30000x30000 the system ran out of memory, and the kernel started killing processes to keep the system running (machine became totally unusable). I didn't want to test this again since I wanted to get the machine online and keep it that way for my other users to be able to check their e-mail (I was down for quite a while since the fsck on the harddrives took a couple hours, and RAID is reconstructing right now as I type this, and for some reason is keeping me from unmounting a drive I need to unmount, which is causing even more problems :( ). I have 128 meg of memory, and about a 128 meg of swap. My assuption was that imagecreate() doesn't do a free memory check before trying to allocate memory for the image and simply assumes its process will get killed or capped or something first. <?php /* usage uhm..just use it (c) Patrik Husfloen 1999 */ function createImg($height, $width, $red, $green, $blue) { Header("Content-type: image/gif"); $imageid = imagecreate($height,$width); $colorid = ImageColorAllocate($imageid, $red, $green, $blue); imagefill($imageid,0,0,$colorid); ImageGif($imageid); ImageDestroy($imageid); } createImg($x,$y,$r,$g,$b); ?>