Re: free allocated memory: HOW ?
| From: | Edward Vermillion | Date: | Thu, 12 Apr 2007 16:50:23 +0000 |
| Subject: | Re: free allocated memory: HOW ? | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-252767@lists.php.net to get a copy of this message | ||
On Apr 12, 2007, at 11:17 AM, Jochem Maas wrote:
Arthur Erdös wrote:It can if you're trying to process a borked image... I've had imagecreatefromjpeg() eat memory up to almost 50x the size of the image before finally deciding it can't handle it and crapping out. That was *after* running it through getimagesize() with no problem at all. Eddon't OMFG me - I can't read your cmdline from here you know, and I'm not the one with a completely borked script/system/whatever. php will not turn a 20.7Kb file into 400+ Megs of consumed memory - unless your read and store it in memory 20000 odd times.int memory_get_usage ( [bool $real_usage] ) Returns the amount of memory, in bytes, that's currently being allocated to your PHP script. it returns the number of *bytes* !!!sure, and memory_get_usage()/1048576 returns the number of megs, or am i wrong? o_OOMFG, YES it does... top shows the script eating 658 megs right after reading the template (~125 megs before)does running top in the cmdline confirm that the script is really eating 100's of Megs?exactly how much ram does the server in question have that you can allow a single script to schlock up almost 2gigs ??dev machine 4 GB, webserver 8 GB of RAM