Re: free allocated memory: HOW ?

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

 




On Apr 12, 2007, at 3:04 PM, Jochem Maas wrote:

Edward Vermillion wrote:

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.

[snip]



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.

okay - good point - but in this case the OP is reading in an html template file,
just a string of 20.7Kb, what could go wrong there?


I got the impression that the OP hadn't really narrowed down where the memory gobbling portion of the script was and was just looking at an overall memory usage of the total process. Then the mention of newsletter and I immediately thought image.

Although a later post I read made it sound like a memory leak in the code, maybe a variable that's holding data for some operation, or an object that's created each iteration, that's not being emptied or reused or destroyed before the next go-round. Leading to a slow consumption of memory over time.

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