PHP Script begins with 15MB already in use
Posted: Wed Feb 09, 2011 8:40 am
I added a new file to our site that just prints out the memory used and before anything has happened memory_get_usage() says there is already 15MB in use. This only happens when I call it from a web browser. When I run the script from the command line, I get a much more reasonable 86KB.
Can anyone think of what might cause this???
results in
[text]
15091064
GLOBALS: 15732 bytes
_SERVER: 3326 bytes
_GET: 6 bytes
_POST: 6 bytes
_FILES: 6 bytes
_COOKIE: 1616 bytes
_SESSION: 2 bytes
_REQUEST: 1616 bytes
_ENV: 1179 bytes
get_defined_vars: 23597 bytes
get_defined_constants: 32605
[/text]
Thanks for your help!
-Tom
Can anyone think of what might cause this???
Code: Select all
<?
echo memory_get_usage();
echo "<br/><br/>GLOBALS: ".strlen(serialize($GLOBALS))." bytes<br/>";
echo "_SERVER: ".strlen(serialize($_SERVER))." bytes<br/>";
echo "_GET: ".strlen(serialize($_GET))." bytes<br/>";
echo "_POST: ".strlen(serialize($_POST))." bytes<br/>";
echo "_FILES: ".strlen(serialize($_FILES))." bytes<br/>";
echo "_COOKIE: ".strlen(serialize($_COOKIE))." bytes<br/>";
echo "_SESSION: ".strlen(serialize($_SESSION))." bytes<br/>";
echo "_REQUEST: ".strlen(serialize($_REQUEST))." bytes<br/>";
echo "_ENV: ".strlen(serialize($_ENV))." bytes<br/>";
echo "get_defined_vars: ".strlen(serialize(get_defined_vars())). "bytes<br/>";
echo "get_defined_constants: ".strlen(serialize(get_defined_constants()));
[text]
15091064
GLOBALS: 15732 bytes
_SERVER: 3326 bytes
_GET: 6 bytes
_POST: 6 bytes
_FILES: 6 bytes
_COOKIE: 1616 bytes
_SESSION: 2 bytes
_REQUEST: 1616 bytes
_ENV: 1179 bytes
get_defined_vars: 23597 bytes
get_defined_constants: 32605
[/text]
Thanks for your help!
-Tom