Does anybody know the way to calculate exactly memory usage of PHP script,
especially the code part of it and to get any ideas which part of it is
taking the memory ?

For approximate calculation of data part I'm using the following:

function mem_size(&$var)
 $s_var = serialize($var);
 $s_var = strlen($s_var);
 return $s_var;

$mem_use = mem_size (&$GLOBALS)
echo "currently using $mem_use";

But my script (it's data part) uses about 250Kb and I'm getting 'not enough
memory' problem or segmentation faluts. The problem is solved by using
    ini_set("memory_limit", "20M");

Standard memory limit is 8M, so I'm wondering what is stored in 7750Kb of
memory limited to PHP by defualt?

Any ideas?

Thanks in advance,

Konstantin Tjuterev

Head of development.
Binfiks Ltd.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to