Re: free allocated memory: HOW ?

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

 



Arthur Erdös wrote:
> answering Jochem:
> 
>> WTF - 386 megs for an html file??? somehow I doubt this is
>> the correct number ... are you reading the memory consumption
>> correctly?
> 
> when the newsletter generation starts memory_get_usage() says ~96 MB in
> use. So approx 290 megs more are used after reading the 20.7 Kb template
> with fread()! I am reading the memory consumption with
> memory_get_usage(), so I dont know what should be wrong with that...

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

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

> 
>> if the values are customized I can't fathom why you would generate
>> 100 emails per loop.
> 
> sorry, my fault, I meant I am generating 100 emails "once", sleep(2),
> then the next 100, and so on... In my case (50xx mails - that results in
> 51 "loops" a 100 mails).
> 

so that's 10,000+ loops (iterations) with a sleep() performed every 100'th iteration.

> 
> answering TG:
> 
>> Couple of questions come to mind...
>>
>> 1. How big is this template that you're loading? Not sure why almost
>> any HTML file would take up 300+ meg of memory when loaded into a
>> variable.  Are you loading images and other content in as well or just
>> the HTML file?
> 
> the size of the template is 20.7 Kb

no way in hell that 20.7Kb turns into 270 Megs if you read the file into php.

are you experiencing severe load on the server whilst the script is running?
and/or is the script actually very, very slow?

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