Re: free allocated memory: HOW ?
| From: | Jochem Maas | Date: | Thu, 12 Apr 2007 12:23:08 +0000 |
| Subject: | Re: free allocated memory: HOW ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-252718@lists.php.net to get a copy of this message | ||
Arthur Erdös wrote:
> Hello all,
>
> is there a way to free memory allocated by variables in PHP?? This is a
> very important issue concerning long running scripts...
this is a recurrent problem - not much can be done about it AFAIK ... I'd
be very glad to be proved wrong.
>
> 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).
okay this does suggest your doing something else very wrong - I personally
have code that regularly generates upto 20,000 individualised newsletters without
going anywhere near this ammount of memory - granted I've hit my memory limit
a couple of times and had to jack it up to 128Megs (in practice the script grab just over
64Megs when it's doing it's worst).
what version of php are you [ab]using?
>
> 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"?
>
> Any suggestion is appreciated!
>
> thx in advance
>