Since a few days, I get the following error on my server:
Fatal error: Out of memory (allocated 262144) (tried to allocate 393216 bytes)
Usually this error is due to a memory consumption that is exceeding the configured memory_limit, but in my case there is no relation. The memory_limit
is set to 128MB
, and in this case, we not even reach 1MB.
Also the server does not have a big load, in fact it is an intranet server, and there are just a few people conected to it.
System: Windows Server 2003, 1Go RAM, only 600 MB used. Apache 2.2.4 PHP 5.2.3
This error is appearing randomly. The memory limit reached also is randomly between a few kB to a few MB. Sometimes restarting Apache is required to get rid of the error, sometimes it disapears itself.
Restarting Apache or the entire server helps temporarily.
Where could this problem come from ? How could I narrow down the error source ?
Also it's per request (someone correct me if im wrong on that) so it's possible to step over the hard limit and error out, particularly on a server where it's sharing memory on a bunch of processed.
you can make a phpinfo.php file with
in it to show the actual setting that is being used. and possibly use PHPTop
to show you quest queries are being run that might attribute. (sometimes POSTS to SQL circumvent the memory limit if they are misjudged in size or grow after the call.)
I later found the same problem on SO Random “PHP Fatal error: Out of memory” errors and more complete Fatal error: Out of memory, but I do have plenty of memory (PHP).
This problem is due to a physical memory limit. There are several possibilities how to run into a such condition, as other processes that take up all the memory, memory leaks in Apache/PHP.