Joomla! Discussion Forums



It is currently Mon Nov 23, 2009 9:48 pm (All times are UTC )

 




Post new topic Reply to topic  [ 7 posts ] 
Author Message
Posted: Fri May 05, 2006 11:17 am 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Fri May 05, 2006 10:57 am
Posts: 1
Hi everybody,

I'm new to the Joomla forums and I hope that I'm posting enough info and I'm right in here.
So, here's my "Bug":

When trying to add a new Menu Item with the Menu Manager, I get this error in Joomla 1.0.8):
Code:
Fatal error: Allowed memory size of 10485760 bytes exhausted (tried to allocate 4057 bytes) in /path/to/my/website/includes/joomla.php on line 2964

The error occurs when I select a Menu Type (it does not matter which type I'm selecting) and press the "Next" Button.
I've tried this on 3 different websites, hosted by 3 different companies.
On an 1&1 Virtual Server with a memory_limit of 32MB it works. On a webspace from http://www.all-inkl.com with memory_limit of 40 MB it does not work. And on a http://www.kontent.de webspace with 10 MB it doesn't work also.
Please don't tell me to change the memory_limit in the php.ini, because I can't do that. What makes me think is that it works with 32MB memory_limit, but it does not with 40MB. What could be the reason?
Is there an error in this function?
Code:
function mosTreeRecurse( $id, $indent, $list, &$children, $maxlevel=100, $level=0, $type=1 ) {
   if (@$children[$id] && $level <= $maxlevel) {
      foreach ($children[$id] as $v) {
         $id = $v->id;

         if ( $type ) {
            $pre    = '<sup>L</sup> ';
            $spacer = '.      ';
         } else {
            $pre    = '- ';
            $spacer = '  ';
         }

         if ( $v->parent == 0 ) {
            $txt    = $v->name;
         } else {
            $txt    = $pre . $v->name;
         }
         $pt = $v->parent;
         $list[$id] = $v;
         $list[$id]->treename = "$indent$txt";
         $list[$id]->children = count( @$children[$id] );
         $list = mosTreeRecurse( $id, $indent . $spacer, $list, $children, $maxlevel, $level+1, $type );
      }
   }
   return $list;
}


I'm not a PHP programmer, but it seems to me that there's something wrong with the function.
Has anyone an idea what to do?

Regards,

Chris


Last edited by stingrey on Sun Jun 04, 2006 4:19 pm, edited 1 time in total.

Top
  E-mail  
 
Posted: Thu May 11, 2006 10:44 pm 
User avatar
Joomla! Hero
Joomla! Hero
Offline

Joined: Mon Aug 15, 2005 4:36 pm
Posts: 2399
Location: Marikina, Metro Manila, Philippines
How many menu items are in the menus where you see this occurring compared with where it is working properly?
Do you see this error in a blank/empty menu?

The function is recursive, so it is possible that it is looping far too many times and exhausting your systems available memory

_________________
God grant me the Serenity to Accept the things I cannot change, the Courage to change the things I can and the Wisdom to know the Difference.


Top
  E-mail  
 
Posted: Wed May 17, 2006 7:07 am 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Sun Aug 21, 2005 8:54 pm
Posts: 81
Location: Potsdam / Germany
same problem with me.

i think it does not depend on the number of menu-items for real...

we knew this problem from some Joomla 1.0.8-Installations on the servers of our customers.

changing the memory_limit in the php.ini solves it, but does this script need so much memory if it is correct???

thanks and kind regards tim.

_________________
http://www.das-medienkombinat.de


Top
  E-mail  
 
Posted: Fri Oct 20, 2006 11:38 am 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Fri Oct 20, 2006 11:36 am
Posts: 2
I've got the same error on joomla 1.0.11 Stable.

I will try to change the php.ini


Top
  E-mail  
 
Posted: Sat Oct 28, 2006 2:28 am 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Thu Jul 06, 2006 8:30 am
Posts: 758
Location: Sacramento
I am getting the same error by using CB and clicking on "profile"
I managed to fix it by inserting this code in the configuration.php
Code:
ini_set('memory_limit', '12M');


Hoever, the day after the error popped out again this time in the confirmation email link for new uers.
I checked configuration.php and my code was gone.
I added it again and the problem disappeared once more.

What is the cause of the error and why di the config file deleted the code?

_________________
Watch the 10 Minute Joomla! Tips Video Podcast
Itunes: itpc://10minutejoomlatips.blip.tv/rss/itunes
Feedburner http://feeds.feedburner.com/10MinutesJoomlaTips
Want your questions featured on the podcast? conticreative.com/questions.html


Top
   
 
Posted: Fri Nov 03, 2006 5:14 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Sep 15, 2005 4:22 pm
Posts: 9
This problem originates in the xml_domit_lite_parser.php file when executing the function parse() (approx. line 1012) in function parseXML() a lot of xml stuff takes place. Using the php function memory_get_usage() (all over the place) I tracked it down to line (approx.) 1767:
Code:
$success = xml_parse($parser, $xmlText);

this adds 200kb to the memory being used generating the page for every menu item so if you have 25 menu items this totals up to 5MB! this usage is never freed up and so when generating the viewMenuItems page it quickly passes the 8MB mark.

I'm not hot enough on what the parser is doing to work out why it doesn't free up the memory on each iteration but this is definately something which needs sorting. This process is only getting the tooltip stuff on the type column - I think it would be easier if when creating the menu items it stored the neccessary info as in the table instead of having to run the xml parser stuff for every menu item.

For the time being my solution to get past the problem is to comment out the loop that reads the xml files and to just output the basic type on the main menu items page:

administrator/components/com_menus/admin.menus.php :: function viewMenuItems() -
between (approx.) lines 245 and 252 comment out the block like so
Code:
//   $i = 0;
//   foreach ( $list as $row ) {
//      // pulls name and description from menu type xml
//      $row = ReadMenuXML( $row->type, $row->com_name );
//      $list[$i]->type    = $row[0];
//      if (!isset($list[$i]->descrip)) $list[$i]->descrip = $row[1];
//      $i++;
//   }


administrator/components/com_menus/admin.menus.html.php :: function showMenusection() -
replace line (approx.) 152
Code:
echo mosToolTip( $row->descrip, '', 280, 'tooltip.png', $row->type, $row->edit );

with simply
Code:
echo $row->type;


As I said if anyone knows the parser better they can probaly crack this either that or the relevant info should be stored in the table when the menu item is first created - this is probably the better option actually as it cuts out a seemingly huge amount of what is unneccessary processing.

Phew!



Old unwanted telephone directorys make ideal personal address books - simply cross out the names and addresses of all the people you don't know.


Top
   
 
Posted: Sun Nov 05, 2006 8:22 am 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Tue Sep 27, 2005 5:21 am
Posts: 3
Location: east onia
I had long time problems with memory exhaust and I tracked the problem to the same line in the xml_domit_lite_parser.php,
Code:
$success = xml_parse($parser, $xmlText);

however I could not see any reason for it in the code. This was a problem not only with adding menu items, but also with content, etc. Increasing the memory limit for php did not help me at all.
Finally I came into a conclusion that the problem resides in server configuration, that is php 5.0.5. My service provider allows to choose different php versions, 4.4.4 and 5.1.6 work without problems.

_________________
information is the most important building material


Top
  E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

Quick reply

 



Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group