< Back to Troubleshooting

Allowed memory size exhausted

If you get an error message similar to
Fatal error: Allowed memory size of 8388608 bytes exhausted at (null):0 (tried to allocate 3840 bytes) in /path/to/commonfuncs.php(245) : eval()'d code on line 1
This means something asking PHP to process too much information at once. There are several known causes and solutions:

1) The most common cause is an overly large forum selector. If you get the error after (or while) submitting or editing a topic, this is likely the problem. To solve that, first go to Admin Panel -> Settings -> Switches and make sure you have the level-based forum selector turned on. Then go to Admin Panel -> Miscallenous -> Advanced Options and run this query in the Run SQL box:
UPDATE {PREFIX}settings SET content=0 where name='maplevels' or name='selectorlevels' or name='submitselectorlevels';
You should find the problem solved after running that.

2) You may be trying to show too many of something per page (probably hundreds). Set a lower number per page at Admin Panel -> Settings -> General. 20 or 30 should be safe with any memory limit. If you want to show hundreds on a page, you'll need to set a 12M or 16M or higher memory limit in php.ini. Contact your web host to request that PHP's allowed memory be increased to at least 12M. If you have access to php.ini, you can add/alter this line yourself: memory_limit = 12M

3) If you only get the message on resizing large images, you have two options: switch from gd to imagemagick at Admin -> Settings -> Files -> graphics method, or up the php.ini memory limit to something large -- say, 24M.

4) If you get this just on your main page, you might have a huge timed action set. You will need to use your admin panel to remove timed actions such javascript and static page exports, etc until it works.

5) Sometimes people change the number of emails sent per page (at Admin Panel -> Emails -> Email Preferences) to something way too large, like 100. The default is 10.