Page 1 of 2

About Memory_limit and fatal errors

Posted: Sat Oct 14, 2006 2:56 pm
by lashae
Hi all,

i've been developing a website on localhost for about a month; i bought a shared hosting (safe mode - on) recently and uploaded to test it online. (Host Plan is a Linux hosting)

The list of components used in the website (Joomla 1.0.11) is: (mainly)

- Community Builder
- Clexus Private Messaging System
- Joomlaboard
- YaNC
- XeSlideGal

and reated a few modules.

When i uploaded the site and tried to sign in i get Fatal error: Allowed memory size of 8388608 bytes exhausted, i understood that the reserved memory is exceeded and further allocations failed, contacted my host (since safe_mode on i can't tune memory_limit via ini_set) and requested them to increase memory_limit; first they declined but accepted then. The previous amount was 6MB and they increased it to 8MB.

This way my problem seemd to be solved, however i noticed that in some pages; for example in 'Profile Edit' page i get another fatal error on the com_clexus module this time.

I googled many hours and couldn't find another solution rather than ini_set thing to tune memory_limit; however i discussed this solution-like thing with my hosting firm and they rightfully refused to increase the memory_limit to 16-20Megs. Their justification was so reasonable; they requested me to imagine 200 concurrent users online on my site viewing the same page which requires 15MB ram than this makes a total of 3GB ram that can't be afforded via shared hosting and adviced me to buy a dedicated server; however i thought that buying a dozens of dedicated servers is not a solution either; because 200 concurrent users is an optimistic scenario; what if 500 people online? Than 7.5GB ram is required...

At this point i'm confused. Is it normal that a PHP script consumes 15MB of memory and although increasing memory limit to 15-20Megs level doesn't this open a backdoor for attacks.

On Joomlapolis site one of the guys stated that Joomla framework consumes 10MB's of RAM, than i want to ask why don't i take the same error on localhost with a 8MB memory_limit. And more interesting thing is that if Joomla requires 10MB's of ram to operate than with how much ram this operated? Or if community builder needs to be run with 15MB's of RAM then how joomlapolis site can  be operated, unbelievable amounts of ram is required for both cases.

As you can understanda i'm confused...

This thread is not purely related with performance maybe but; the make the site run in optimum performance and operation point i need to discuss the memory_limit thing.

Waiting for ideas and clarification


Re: About Memory_limit and fatal errors

Posted: Sat Oct 14, 2006 3:14 pm
by brian
8mb is more than enough for something like joomla. the only time I ever hear people recommending more is because they are using a poorly written extension which is guzzling the ram.
do you have opensef installed? I know that some of the extensions for opensef are a source of disappearing ram. a dev of one of the extensions to opensef  even tried to tell me joomla required 24mb.

Re: About Memory_limit and fatal errors

Posted: Sat Oct 14, 2006 4:49 pm
by lashae
OpenSEF is not installed, i also don't use Joomla's built-in SEF support.

We need to investigate this problem here and as i stated in my first post clarify the problem and solution, because i can give references to tens of posts that offers increasing the memory_limit towards 20MB to solve(?) this problem without knowing what they really do?

These people claiming that the only solution is increasing the memory_limit doesn't know some facts or i'm really confused.

Please don't hesitate to share what you know, this is a serious problem both for performance and security aspects.

Re: About Memory_limit and fatal errors

Posted: Sat Oct 14, 2006 6:04 pm
by brian
I suspect one of the extensions. disable them one at a time and test

Re: About Memory_limit and fatal errors

Posted: Sat Oct 14, 2006 6:10 pm
by lashae
That's of course a logical way of debugging but the source of problem seem to be Community Builder because i was getting error on cb_login, and after increasing the memory_limit 2MB's i could be able to login but now on profile edit page the com_clexus module on the right gives fatal error if i move module to the left CB gives error. I think it's sure that the problem rises from CB, however the main idea i started this thread is to discuss the underlying reasons and reasonable solutions.

After detecting the source of problemyou may probably offer me to uninstall CB but i can't like thousands of people, CB is not a dummy component, so i need intellectual ideas to detect and hope to find a solution; since CB is opensource &GPL i feel myself to be responsible to find a solution too.

brian wrote: I suspect one of the extensions. disable them one at a time and test

Re: About Memory_limit and fatal errors

Posted: Sat Oct 14, 2006 6:14 pm
by brian
one thing I have found in the past is that logs can be misleading. maybe you should take this problem over to the cb forum. if as you suspect the problem is with cb and not joomla there's not much joomla can do about it

Re: About Memory_limit and fatal errors

Posted: Sat Oct 14, 2006 7:23 pm
by Beat
The original poster already opened also a thread on CB forum, as I understand.

I'm running my test-installation of Joomla + CB with 8 Mbytes without problems, and it also works ok with 4 MBytes. I don't see where CB would be requesting MBytes of memory, but sometimes PHP is rather surprising in allocating big chunks of memory, and never releasing them. E.g. saw 46 kbytes for the login module seems big compared to requirements, but it's not Mbytes.

Actually, it can well be a mambot or another extension using lots of memory and not freeing it up

Does anybody know of any tool to visualize and track PHP memory usage ?

Side-note: in your example the statement is wrong, it's not 200 concurrent users on the site which need 200 processes, but 200 concurrent page-generations, meaning 20'000 online users clicking all 10 seconds on average...supposing that your server can generate them in 5 mili-seconds...very very high users numbers, even for busy sites like this one.

I will do some memory tests in the next days. Anybody knowing of any tool for PHP ?

Re: About Memory_limit and fatal errors

Posted: Sat Oct 14, 2006 7:57 pm
by lashae
Beat wrote: I will do some memory tests in the next days. Anybody knowing of any tool for PHP ?
That's the good news Beat, because we need an engineering approach to overcome this problem; because everyone repeats like a parrot to increase memory limit then how do people run Joomla+CB with 8MB memory_limit?

If you want i can list my complete component, module & mambot list, but liked the idea of tracking the mem. usage of all php scripts; however i'm not sure it's possible to measure included scripts' memory consumption, any idea?

Re: About Memory_limit and fatal errors

Posted: Fri Oct 20, 2006 9:33 am
by abubin
we are also having similar problem with joomla+cb+smf installation.

You can see from my post that my httpd uses around 80mb of memory just for 1 user alone. Imagine having 20 users at the same time. I don't understand why it's still using so much memory when my apache is already configured with default 8mb limit. I have tried halving my members db to 50,000 and memory usage drops to 50mb process.

Don't tell me all this while people only uses joomla+cb+smf with less than 10,000 users in their database.

Re: About Memory_limit and fatal errors

Posted: Fri Oct 27, 2006 4:23 am
by corrado444
I just encountered this very problem on my brand new site. The funny thing is that it worked just fine right before I went to dinner and I restarted my computer. I logged in again and now I see the message when I try to see the profile on my CB login.

The truly bizarre thing is that my site has not launched. I am hosted at hostgator with a reseller account and only 2 domains on my part of the server. No one knows about my site beside me, my wife, a friend in a wheelchair and my cat. How the hell am I getting this error? My total CB membership is 2: me and me as a test user. There is no way that I am putting too much of a load on the server, unless the other resellers on the same server have just sold a couple of thousands of sites in the past half hour.

This is getting a bit too much. I am running Joomlaboard, CB, OpenSEF (after using 404sef and crashing miserably CB) and a smattering of modules, but nothing since the last time the login page worked fine.

Is there any chance that the server is under unusual stress and this is temporary?

If anywane wants to come and crash my site, the URL is I'd be really interested to know what I am going to do if I get a few users on the site (fat chance with CB broken).

Thank you

[Solved] Re: About Memory_limit and fatal errors - I may have a solution

Posted: Fri Oct 27, 2006 4:54 am
by corrado444
I did a few quick Google searches on this topic and I came up with a bunch of information.
The most useful was at some obscure open source project were a script was having the same problem.

Their suggestion was to insert this line:

Code: Select all

memory_limit = 12M 

in the .htaccess file.

My server did not like that a bit and crashed miserably, but by searching the line above I came to a post on the Drupal forum where they suggested to either do the same thing with the .htacces file or to place this line

Code: Select all

ini_set('memory_limit', '12M');
in their "config" file (it's different in Drupal, here is the link to the post:

Well, I took

Code: Select all

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

and in a moment of utter inspiration I placed it as the last line in the configuration.php file of my Joomla installation.

I have to confess that I didn't think it would work. These php calls are a bit fuzzy to me at times and I certainly have no idea what happens in PHP when I insert a line like that, except that it asks for more memory when running a script.

It worked!!! I can't believe it. I went to my site, clicked on "profile" and the darn thing loaded just fine.

Just to make sure I commented out the line and tried again (in case the sysadmin woke up and fixed the server) and the error appeared again.

As far as I am concerned, this one is solved. I must place this line of code in my vault. This was such a smart move that I can't believe it was me that did it!


[solved]Re: About Memory_limit and fatal errors

Posted: Sun Oct 29, 2006 8:42 pm
by corrado444
Hi I already had marked this topic solved, but it was premature.
This solution may only work on my reseller plan, but either the php.ini or the .htaccess fix should work on most servers.

These are the three solutions I found googling around:


Code: Select all

memory_limit = 12M  
in php.ini file (or in a php.ini in the joomla root)

Code: Select all

ini_set('memory_limit', '12M'); 
in joomlaRoot/configuration.php

Code: Select all

php_value memory_limit 12M 
  in .htaccess file in the root

The problem I encountered with the solution I found with 2 is that writing

Code: Select all

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

in configuration.php works but the file gets written over each time the admin preferences are accessed in Cpanel.

#3 did not work in my hostgator server and #1 didn't either at first. However, when I tried again it did work fine and the problem was solved for good.
I believe the first time I edited the custom php.ini file in my root (I have no access to the actual php.ini) I must have made a mistake. I apologize for the confusion but I hope that this solution will help others with the same problem.
It would be nice to know why it takes so much memory to run these scripts, but that's another post.


Re: About Memory_limit and fatal errors

Posted: Tue Nov 07, 2006 9:22 am
by lashae
Servers which are running under "Safe Mode=On", it's not allowed to set php memory limit; in deed it's not a general solution; maybe only a workaround. And moreover, i still think that 12MB is a quite high limit.


Don't you have any good news on this problem?

Re: About Memory_limit and fatal errors

Posted: Tue Nov 07, 2006 11:44 pm
by corrado444
Hi, I will post a more detailed solution and workaround later, after I decipher all the issues related to the way my server is setup.
What happened is that right after I created my reseller hosting account with, they started migrating their servers one by one to PHPSuExec and that created various configuration problems not only for me, but for scores of resellers and their clients.

I am still investigating the workarounds, but I know for sure that on my server the .htaccess solution does not work, while the php.ini one does.

As stated above, inserting

Code: Select all

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

in php.ini solves the problem

I also tested lower and higher memory and while setting it higher has no discernible effect, setting it lower does. Too low (and at the moment I don't quite recall how low) and the memory problem occurs.

Also, from my research I found out that this is not the only area where there are such memory "leaks" nor is Joomla the only CMS or script affected. In fact, I originally found the solution on a Drupal forum.

I will get back to this topic as soon as I have a cohesive answer to all the issues.


Re: About Memory_limit and fatal errors

Posted: Sun Nov 12, 2006 5:40 pm
by schipperijn
I'm happy this topic is started. Its what I would like also. I have a limit of 32Mb cache at the database. 1 sites sudenly gets a fatal error because of cache.

I have recently posted a topic about the error...I think in the wrong forum...No reply's yet.

Somehow when I click on the mainmenu inside the menumanager this happen (at the administrator). I have deleted some components like BSQ statics ...not helping this. Its a menu with 1 of them with about 30 submenu's

Its Joomla 1.08, php 4.4.2, apache

About 300 content items run with component multi site manager.

But how can it be possible that the menu manager and than only the mainmenu can not be opend and uses more than 32 Mb cache???

Is it the old Joomla version. Could it be the multi sitemanger pro component? (I can not deactivate it...all wil be lost)
Is it the old PHP 4.4.2 version in combination with joomla 1.08 that use a sudden High Cache?,113204.0.html is the topc I started

Would be nice to know more about how many cache is used by all parts

Re: About Memory_limit and fatal errors

Posted: Sun Nov 12, 2006 8:05 pm
by schipperijn
Ok when I put the folowing code, thanks Robink and DeanMarshall, the mainmenu manager is working again...but fore how long?

php_value memory_limit 35M

Inside the .htaccess

Why is the mainmenu manager taking 33Mb of cache? Is that not a bit much? For 42 menu itesm, some top and most of them submenu

Re: About Memory_limit and fatal errors

Posted: Sun Nov 12, 2006 8:13 pm
by corrado444
$64,000 question. It seems absurd to me too. However, I did not notice any adverse reactions one way or another.

It could be that the memory requrements peak at that figure for just an instant or that the program "looks like" it needs that much memory but in effect it doesn't use it.

Who knows, I glaze over after a while researching this stuff.

As an update, I just installed Pony Gallery on my joomla and before I unistalled (working erratically) I received the same alert but on the admin site this time. I should have tried to place php.ini in the admin dir but I forgot. Same error though

Re: About Memory_limit and fatal errors

Posted: Mon Nov 13, 2006 11:45 am
by schipperijn
Could it be that the "13 queries executed" is the problem. That counting all content items etc is the reason why 33Mb is used when editing Mainmenu inside menu manager.

Filling that CID or something.
A lot menu items (like 30 submenu's have like 150 Content items nd some even more.

The only thing that I would like to do in a menu manager is to make the connections, not a counting. So if I only make the connections to blog categories it would nit have to do a querie to count content.

It is just a feeling I have and I'm not good in PHP and MSQL

Menu's that do not have much content do not use a lot Cache and did work before I adjusted it to 35 Mb cache

Not that I think its a bug...its only interesting if this could work better with less Mb. Most users are going to have this problem with cache if the site is going to grow.

It could be also a warning to not make to much menu items with to much content items in it when you have less Mb.

Re: About Memory_limit and fatal errors

Posted: Mon Nov 13, 2006 11:58 am
by schipperijn
Here I read a interesting story: ... #msg363409

Not that I think Joomla people are leaving...I think it will stay growing to be the best CMS and already community.

But as I read...This user of me has Joomla 1.08 for his site. And as I read that topic it is better to have 1.09 becausse of "1.0.9 is 62% fewer queries than 1.0.0"

Is there already a big differents inside joomla 1.5 VS 1.011 in using cache at the menu manager???

Re: About Memory_limit and fatal errors

Posted: Mon Nov 13, 2006 1:44 pm
by schipperijn
When I put the site on maximal error reporting I see something else...also a differents between menu's that already did work and are smaller and the minmenu that uses 33Mb:

This line will apear above the mainmenu items inside the mainmenu manager:

Notice: Only variable references should be returned by reference in /home/trouwen/UI4ME3UQ/groningen/includes/domit/xml_domit_lite_parser.php on line 928

That line is not just 100 times there ...its there about 3000 times this line (counted it with joke).

In the other menu's like topmenu with less menu items I will see this line like 100 times.

I read in a other forum topic that this line is no problem and for devolepers, but 3000 times...would this not be an attack on server health?

Re: About Memory_limit and fatal errors

Posted: Mon Nov 13, 2006 2:33 pm
by schipperijn
At a other website, with Joomla 1.011 I do have the same. So an upgrade will not help I think. If it's needed to help  :D

There I have the same line in mainmenu:
Notice: Only variable references should be returned by reference in /home/schipperijn/0TB3J3H5/htdocs/includes/domit/xml_domit_lite_parser.php on line 916

Notice: Only variable references should be returned by reference in /home/schipperijn/0TB3J3H5/htdocs/includes/domit/xml_domit_lite_parser.php on line 928

But not 3000 times...Also about 300 times.
Here the menu is also small, only 5 menu items inside mainmenu. All top menu's.

Inside Top menu I have 1500 times this line and that with 23 menu items (top and submenu items).

Re: About Memory_limit and fatal errors

Posted: Sat Dec 02, 2006 12:03 am
by xainoo
what if all the ways didn't work with me?
my host accept limited .htaccess functions and no modification of php.ini
any suggestions?

Re: About Memory_limit and fatal errors

Posted: Sat Dec 02, 2006 10:32 am
by schipperijn
Yes sounds not ok. Did you try the line php_value memory_limit 35M inside .htaccess? If that would not work, same with other solutions you will have a problem I think with only solution...go to other hoster (provider).

I have an other topic about this at,113204.0.html. So if I understand it ok leak of cache will be there also inside Joomla 1.012. Inside Joomla 1.5 the whay some functions work this leak of cache will be history (hope so). Afcourse some components use cache, but some parts of Joomla could already give the problem of low cache inside database (with big menu setups). If you than can not adjust it, and the hoster (provider) does not want to set it a bit higher... :'(

Lets hope Joomla 1.5 has this much better  :pop
Than lets hope your hoster can run a script like Joomla 1.5  :)

Joomla is a very nice system with great community around it, lets say Uniek :-*. So it will not be a solution to search for a other sytem that works better with that cache.

Re: About Memory_limit and fatal errors

Posted: Wed Feb 07, 2007 8:15 pm
by schipperijn
Now with just a new website I'm setting up I get already this error:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 82 bytes) in /home/walzhardcore/DGI704ML/htdocs2/includes/domit/xml_domit_lite_parser.php on line 916
I added
php_value memory_limit 35M
into .htacces file and than it worked again.
What has happen?

I added just 1 extra submenu inside the menu manager "mainmenu". All together than 36 menu items. 8 topmenu's so... 28 submenu's.
They need to be there. Its not much alsow I think. All submenu's are in a dropdownmenu at frontend from Rockettheme template.

So sites with a bit more menu items...proplemo!

Its a Joomla 1.012 website. Just new. Not much content items (28 content items).
No SEF at the moment. All with globals just fine and register globals off.
PHP 4, Mysql 4
Only HTMLsuite pro newest version and JoomlaXplorer newest version and Joomfish newest version.

This is what I find that causes the memory leak:

return $node;

from a part of code:
* Creates a new DOMIT_Lite_Element node
* @param string The tag name of the element
* @return Object The new element
function &createElement($tagName) {
$node = new DOMIT_Lite_Element($tagName);
$node->ownerDocument = $this;

return $node;
Does anybody know what this ellement is doing. Can Joomla 1.012 work and be save without it??!
There is a lot docs on the internet if I enter DOMIT_Text node inside Google search. Do not see it yet.

Re: About Memory_limit and fatal errors

Posted: Wed Feb 07, 2007 9:34 pm
by schipperijn
I have done some trics inside the mainmenu...if it are trics :laugh:

I have removed 18 Blog - content categories (inside submenu's).
In place of this...
I added 18 Link - Content Item (inside submenu's).

Removed before adding those 18 links to mainmenu the code "php_value memory_limit 35M" from the .htaccess.
Than added again 3 more new blog - content categories... so even more menu items than before the error with less cache using.

  :( :o ??? ..... :'( :laugh:

Re: About Memory_limit and fatal errors

Posted: Thu Feb 08, 2007 12:38 am
by schipperijn
I have found an interesting topic. Not only that...a lot systems have this problem:

part of error: Notice: Only variable references should be returned by reference in
(for me a lot of them, some just the same repeathing, above the mainmenu manager, with error reporting at high)
..addresses a serious memory corruption problem within PHP concerning references. If references were used in a wrong way, PHP would often create memory corruptions which would not always surface and be visible.
link to that topic: ... #msg_26311

Does anybody know a bit about this? (I'm just a beginner  :-[  )

Re: About Memory_limit and fatal errors

Posted: Fri Feb 09, 2007 2:12 pm
by Hackwar
I'm guessing one of your extensions is poorly coded and the corresponding XML is crashing XML DOMit. Check your extensions. I have a bout 100 menu items in submenues and all and it works perfectly fine with 16 MB.

Re: About Memory_limit and fatal errors

Posted: Mon Feb 12, 2007 2:29 pm
by schipperijn
Hello Hackwar,

I have now a lot research in it. Pitty my english and php is not on high level. I'm verry sure its inside Joomla now. Its all about refference returning. From a php 4 version the scripter will get this warning. Thats why the this lines are there.

If I install a Joomla system, clean and without anything in it, its already there.
There are PHP versions that will not give this error line but still this erro will be there.
Its getting into a loop and php will make a error with the cache.

So lets say...the combination

If I read more about this item you can see a lot systems (cms, forum, gallery's etc) have this problem...bad code somewhere that using the refference bad.

So...why would you not have it. Could be that something on your server or inside PHP is different.
1 thing it is not...a 3e party mambot, component, module or even template...not in this case. A lot Joomla users have this problem.

When I have more time I will ceck if Joomla 1.5 with php 5 and Mysql 5 will have the same at the mainmenumanager.

Could it be you have not much blog categorie menu items?

Re: About Memory_limit and fatal errors

Posted: Fri Feb 16, 2007 12:58 pm
by schipperijn
Yesterday I was at a other server, with same PHP version, same menu etc...
No errors at mainmenu.

Could it be that this is the problem somehow;
disable_functions mb_send_mail, dl, exec, passthru, proc_open, proc_close, shell_exec, system, popen, pclose, ftp_exec, getrusage mb_send_mail, dl, exec, passthru, proc_open, proc_close, shell_exec, system, popen, pclose, ftp_exec, getrusage

Re: About Memory_limit and fatal errors

Posted: Wed Dec 05, 2007 7:22 am
by agentapproved
Hi I was having a problem with community builder when I clicked on the register button it just went to a blank page, with no errors.  I was referred to this thread from a community builder thread, on that thread they solved a similar problem by increasing the memory in the the way described above. I found that it did not work. So I unpublished cb plugins one by one until I found that when cbcaptcha was unpublished everything worked fine. I am no expert but I feel that the solution of increasing the memory is not a correct solution rather to problems with nature. It appears that poorly coded plugins are the cause of the problems and increasing the memory in such a manner is only masking a symptom and is not fixing anything.