I started getting "Fatal error: Allowed memory size of..." errors
while developing my CakePHP app. In order to find out what's going on
and where all the memory is going, I started placing some
memory_get_usage() calls in my code. It seems like somewhere between
my controller's construct method and beforeFilter() callback, almost
9MB of memory are being used by CakePHP. Here's the code I'm using to
test:
function __construct() {
echo '<pre>Memory Usage (construct): ' .
number_format(memory_get_usage(), 0, '.', ',') . " bytes\n</pre>";
parent::__construct();
echo '<pre>Memory Usage (construct): ' .
number_format(memory_get_usage(), 0, '.', ',') . " bytes\n</pre>";
}
function beforeFilter() {
echo '<pre>Memory Usage (beforeFilter): ' .
number_format(memory_get_usage(), 0, '.', ',') . " bytes\n</pre>";
// other code here
}
And here's the resultant output prior to the error popping up mid-
processing:
Memory Usage (construct): 5,567,008 bytes
Memory Usage (construct): 5,594,008 bytes
Memory Usage (beforeFilter): 14,153,232 bytes
What I'm wondering is why does CakePHP need so much space in memory?
Could I possibly be doing something wrong such that this is
happening? I don't suspect my app_controller.php containing any
issues considering the minute change between the two
memory_get_usage() calls within __construct().
Any input is greatly appreciated, as this has quickly ground my
development efforts to a halt.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---