Re: free allocated memory: HOW ?

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

 



I am using PHP version 5.1.2. on my dev machine. The same problem with 
PHP 5.2.1 on webserver.

I am generating mails based on a HTML Template. After reading the
template with fread() memory_get_usage() says ~386 MB in use...

Then the placeholders in the read template are replaced by customized 
values within a loop. The size of the used memory grows permanently in 
each loop by approx 30 MB (100 newsletters are generated per loop).

any ideas what i am doing wrong and where i [ab]use php? ^^


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

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