Fatal error: Out of memory (allocated ...) (tried to allocate ... bytes) not due to memory_limit setting

5,202

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.

Share:
5,202
Lorenz Meyer
Author by

Lorenz Meyer

Allround IT specialist: PHP, VBA and JavaScript programmer Help Desk Network administrator (MCSA) Database administrator (MCDBA)

Updated on September 18, 2022

Comments

  • Lorenz Meyer
    Lorenz Meyer over 1 year

    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 ?

    • Lorenz Meyer
      Lorenz Meyer over 10 years
      @DavidSchwartz I didn't insist on the random nature of the problem. I added details to the question.
  • Lorenz Meyer
    Lorenz Meyer over 10 years
    phpinfo() shows a Local and a master value of 150M for memory_limit.