6

Possible Duplicate:
What is causing “Unable to allocate memory for pool” in PHP?

Today I noticed the next error:

ErrorException: Warning: require() [function.require]: Unable to allocate memory for pool. in /symfony/symfony/src/Symfony/Component/ClassLoader/DebugClassLoader.php line 82

Its a strange error, if I reload the page sometimes 2 files has this error, other times all the files.

It is in my JS and CSS files.

Community
  • 1
  • 1
Mitchel Verschoof
  • 1,543
  • 4
  • 20
  • 38

1 Answers1

19

This error is usually related to Alternative PHP Cache (APC) related which is a free and open opcode cache for PHP. Its goal is to provide a free, open, and robust framework for caching and optimizing PHP intermediate code. Edit /etc/php.d/apc.ini, enter:

# vi /etc/php.d/apc.ini

Make sure the mktemp-style file_mask to pass to the mmap module is correct and valid one:

apc.mmap_file_mask=/tmp/apc.XXXXXX

Next make sure the size of each shared memory segment, with M/G suffix is set correct as per your requirements. In my case it was set to 8M:

apc.shm_size=96M

You need to adjust the number of seconds a cache entry is allowed to idle in a slot in case this cache entry slot is needed by another entry:

apc.ttl=3600

The number of seconds a user cache entry is allowed to idle in a slot in case this cache entry slot is needed by another entry:

apc.user_ttl=3600

The number of seconds that a cache entry may remain on the garbage-collection list.

Save and close the file. Make sure you adjust the values as per your requirements. Restart the Apache 2 web server:

# service httpd restart
Julien
  • 1,946
  • 3
  • 33
  • 51