Re: free allocated memory: HOW ?

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

 



On Thu, April 12, 2007 6:40 am, Arthur Erdös wrote:
> is there a way to free memory allocated by variables in PHP?? This is
> a
> very important issue concerning long running scripts...
>
> I have a script that generates > 5000 Newsletters and when the script
> finishes it uses 1.8 GB (!!) of RAM. Although I am using unset() to
> clean up variables (tried with $var = null too).
>
> I've read sth about php not giving the allocated memory back to the OS
> until a script finishes, is that right?? Is it possible to free the
> memory "by hand"?

PHP garbage collector CAN free up some unused memory, if your code
makes it patently clear that you will no longer be using that data.

And if php.ini settings are reasonable.

You also need to be clear about how you measured 1.8 G -- What you are
looking at may be a record of how much RAM PHP used at the maximum,
for some particularly long/nasty Newsletter with attachments and
photos or something...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
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