Re: free allocated memory: HOW ?

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

 



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

sure, and memory_get_usage()/1048576 returns the number of megs, or am i
wrong? o_O

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

OMFG, YES it does... top shows the script eating 658 megs right after
reading the template (~125 megs before)

the read method does following:

// read the newsletter template
$fh = fopen($file, 'r');
$theData = fread($fh, filesize($file));
fclose($fh);
return $theData;

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

well, the script is not very, very slow... it takes ~3-4 seconds to
generate each newsletter (including database querys for the customized
data)

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