0

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 ?

2
  • The memory_limit somewhere may be set to 128MB, but not the memory_limit that apache's PHP is using. Nov 1, 2013 at 16:44
  • @DavidSchwartz I didn't insist on the random nature of the problem. I added details to the question. Nov 1, 2013 at 16:52

2 Answers 2

0

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

<?php

// Show all information, defaults to INFO_ALL
phpinfo();

?>

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.)

1
  • phpinfo() shows a Local and a master value of 150M for memory_limit. Nov 5, 2013 at 7:23
0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .