• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Unable to allocate memory for pool

#1
Hello,

I just installed Xenforo the other week with Xenporta. It was going great till today. I would get white pages and sometimes an error (quick mention) that said something : there is an error try later.

Then later i could acces the page and would goto the admin CP it would show a blank white page.

Now i can go thru the logs and i see these errors happening a few times a day.

Message : include(): Unable to allocate memory for pool.
File : library/XenForo/Autoloader.php:119

Details : Generated By: Unknown Account,

Stack trace
#0 /home/wargy/sites/cctld.dk/www/library/XenForo/Autoloader.php(119): XenForo_Application::handlePhpError(2, 'include(): Unab...', '/home/wargy/sit...', 119, Array) #1 /home/wargy/sites/cctld.dk/www/library/XenForo/Autoloader.php(119): XenForo_Autoloader::autoload() #2 [internal function]: XenForo_Autoloader->autoload('XenForo_Error') #3 /home/wargy/sites/cctld.dk/www/library/XenForo/Cron.php(34): spl_autoload_call('XenForo_Error') #4 /home/wargy/sites/cctld.dk/www/library/XenForo/Cron.php(64): XenForo_Cron->run() #5 /home/wargy/sites/cctld.dk/www/cron.php(12): XenForo_Cron::runAndOutput()
Request state:
array(3) { ["url"] => string(35) "http://cctld.dk/cron.php?1307555356" ["_GET"] => array(1) { [1307555356] => string(0) "" } ["_POST"] => array(0) { } }

Now i am no wizzard when it comes to this. I have the feeling it is maybe related to the Registered Feeds?
I have a few running that fetch some at certain intervals and post them in different sections on the forum.

My forum is located here : http://cctld.dk there is not much there yet. Just some posts and articles and guides that i wrote.
So i consider the forum tobe in a rather vanilla state.

Any info is greatly appriciated.

Wargy
 

Brogan

XenForo moderator
Staff member
#2
Are you on a shared server?

Random errors such as this are usually due to overloading of resources, specifically memory allocation as indicated by the "Unable to allocate memory for pool" message.
 

Jake Bunce

XenForo moderator
Staff member
#3
This is a problem with APC. Here are some reported fixes I found:

http://pecl.php.net/bugs/bug.php?id=16966

[2011-03-31 17:48 UTC] bstillman at gmail dot com

For what it's worth, I found this page searching for the same problem.
Changing apc.mmap_file_mask=/tmp/apc.XXXXX to
apc.mmap_file_mask=/dev/zero resolved the problem as far as I can tell.
It's the only change I've made, and the problem doesn't seem to be
coming back. I'll post back if it does come back.
http://stackoverflow.com/questions/...require-once-unable-to-allocate-memory-for-po

solution for me: apc.ttl=0 apc.shm_size=anything you want

had the same issue on centos 5 with php 5.2.17 and noticed that if the cache size is small and the ttl parameter is "high" (like 7200) while having a lot of php files to cache, then the cache fills up quite fast and apc doesn't find anything which it can remove because all files in the cache still fit in the ttl.

increasing the memory size is only a part solution, you still run in this error if you cache fills up and all files are within the ttl.

so my solution was to set the ttl to 0, so apc fills up the cache an there is allways the possibility for apc to clear some memory for new data.

hope that helps

edit: see also: http://pecl.php.net/bugs/bug.php?id=16966

download http://pecl.php.net/get/APC extract and run the apc.php, there you have a nice diagram how your cache usage look like
 
#4
Hello Brogan, no i am on a dedicated one . though i am sharing it with another site that runs VB for 11 years now (maybe they will switch haha).

Thanks Jake. One of the guys who is helping me out thinks you are deadon with the APC. He made some changes and we will see how it goes. I will report back if it is solved or not.

Have a great day and thanks for the help so far !
 

craigiri

Well-known member
#7
Confirmed that it is set in php.ini

I get the error, but the ttl is already zero. I increased the memory and will see what happens.
 

craigiri

Well-known member
#8
It seems the increased memory may have fixed those "unable to allocate" errors.

As a point of information, I think most XF users can get by with 50-150 MB's of memory allocated to APC. I am running XF plus many add-ons plus another CMS and other scripts and, with a setting of 128 MB, am getting a 100% hit rate. That's over 61 million connections in 12 hours as reported by APC. only about 2/3 of that 128 has been used so far to achieve that hit rate (80 megs or so)

The stock setting was doing OK, but probably having to flush the APC cache often.