27th August 2014

How to solve Unable to allocate memory for pool

John Ennew
Technical Director

If you are getting the error:

Warning: require_once(): Unable to allocate memory for pool. in module_load_include()

This is due to having insufficient memory allocated to the PHP op code caching library called APC. This can be easily fixed via a setting in your php.ini file. Look for the section titled [apc], if you have not got one, add it to the end of the file. Mine looks like the values below. The one to change is apc.shm_size which needs to be larger. I've found 256M seems to solve the issue, you might have to try different values for your own setup.

[apc]
apc.enabled=1
apc.shm_segments=1
apc.shm_size=256M
apc.ttl=7200
apc.user_ttl=7200
apc.num_files_hint=1024
apc.enable_cli=0

You will need to restart your web server after making this change.

Acquia dev desktop

If you are using Acquia dev desktop, you can edit your php.ini file by going to the preferences/settings, then config then click 'edit' next to the PHP section. If you use multiple PHP environments (e.g. PHP 5.3 and PHP 5.5.) you'll need to add the above code to each PHP.ini that you use. To restart the web server, you can just close Acquia Dev Desktop and then reopen it again.