Reputation: 650
In my application i often encounter with this error
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 52944 bytes) in C:\xampp\htdocs\demo\index.php on line 337
so far i am working on localhost and encountered with memory error what when i deployed my application on to server where many user perform same operation at a time.
i just want to ask how can i check what are the resources that is in the memory
and is on to the server each user get a separate memory are all user use 128 Mb of memory that i used in my localhost
Upvotes: 0
Views: 45
Reputation:
You can check RAM usage with this function:
function getRamUsage($size) {
$unit = array('b','kb','mb','gb','tb','pb');
return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
}
Example:
$ramUsage = getRamUsage(memory_get_usage(true));
Anyway, IMHO your code needs to be reviewed and/or rewritten. Please post some code, what is happening in your index.php on line 337 ?
Upvotes: 1
Reputation: 914
Locally turn error_reporting to E_ALL see if anything is being outputted, as you may have error messaging suppressed on your server but it still may be buffering this to a file or database table if you have this set up, this can exhaust memory and the speed of your app
Upvotes: 0