Out of memory?
Monday, 10 December 2007 05:07

Joomla seems to be out of memory...

Sometimes and on SOME servers, Joomla seems to be out of memory. The message looks as follows :

Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 98305 bytes) in /home/dev/www/dev.site.com/administrator/index.php on line 45

The error can occur on any place and in any file. Don't look in that particular file for what went wrong, you won't find anything. Sometimes the memory to be allocated is 1 (one) byte ! AND IT FAILS! Certainly this is raging and you will not know where to look. Some even say to reinstall Joomla or worse: reinstall the server.

One possibility is to set the following in your php.ini (on your server installation):

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 30
max_input_time = 60
memory_limit = 40M

The standard amount of memory is

memory_limit = 8M

Now that IS a solution, but often you cannot get to the php.ini file, certainly when you're on a shared hosting service. That's where troubles begin and never seem to end. You start to look for components (if the backend is not affected at least) and uninstall them. Thus ruining you site. After that you may want to change your hosting service and finally give up...

There is another solution.

Find the /globals.php file and add

ini_set( 'memory_limit', '40M');

before the final ?> in the file. Now your Joomla installation may take up to 40M (instead of the standard 8M) and may feel itself a lot better (and will be faster too).

Of course this is only a patch on a wound, but at least you get your Joomla installation up and running again and you can finish what you wanted to do.

Another "fix" stated on the web is to set the memory_limit to -1 (minus one) and so disable it. That is fine if you know for sure that the components you are using have no troubles, and just need more memory. But if you don't know all about your installation (like most of us) you will not know if one day (sooner or later) you will not end up using ALL memory of the server allowed to you and blow up the installation for good (server restart or at least an apache_restart). My advice is to set the limit high enough to be comfortable, but NOT to disable it.

Last Updated on Tuesday, 15 January 2008 05:14