Search code examples
phpcachingmemoryapc

What is causing "Unable to allocate memory for pool" in PHP?


I've occasionally run up against a server's memory allocation limit, particularly with a bloated application like Wordpress, but never encountered "Unable to allocate memory for pool" and having trouble tracking down any information.

Does anyone know what this means? I've tried increasing the memory_limit without success. I also haven't made any significant changes to the application. One day there was no problem, the next day I hit this error.


Solution

  • Probably is APC related.

    For the people having this problem, please specify you .ini settings. Specifically your apc.mmap_file_mask setting.

    For file-backed mmap, it should be set to something like:

    apc.mmap_file_mask=/tmp/apc.XXXXXX
    

    To mmap directly from /dev/zero, use:

    apc.mmap_file_mask=/dev/zero
    

    For POSIX-compliant shared-memory-backed mmap, use:

    apc.mmap_file_mask=/apc.shm.XXXXXX