Re: free allocated memory: HOW ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Apr 12, 2007, at 11:17 AM, Jochem Maas wrote:

Arthur Erdös wrote:
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_O

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
does running top in the cmdline confirm that the script is really eating 100's of Megs?


OMFG, YES it does... top shows the script eating 658 megs right after
reading the template (~125 megs before)

don'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.


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.

Ed
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux