Jump to content

[SOLVED] Allowed Memory Size Exhausted? wuuuuuut


Altec

Recommended Posts

I'm attempting some form of expandable/modular administration panel for my site. I finally got the code nailed down after a few tries. I go to load the page and:

 

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 33292286 bytes) in index.php  on line 53

 

I have never run across this before. My code to build the menu (of which is causing this error) is:

$menu = (string) null;
$modules_dir = ADMIN_ROOT.'modules';
$dir = opendir($modules_dir);
while( ( $module = readdir($dir) ) !== false )
{
if( is_dir($modules_dir.'/'.$module) && !in_array($module,array('.','..')) && file_exists($modules_dir.'/'.$module.'/module_meta.php') )
{
	include($modules_dir.'/'.$module.'/'.'module_meta.php');

	$meta_function = $module.'_meta';
	$menu_init = $meta_function();
	$count = count($menu_init) - 1;

	$menu .= '<h2>'.$menu_init[0].'</h2><ul>';
	for($i = 1; $i != $count; $i++)
	{
		$menu .= '<li><a href="'.$menu_init[$i]['link'].'">'.$menu_init[$i]['title'].'</a></li>';
	}
	$menu .= '</ul>';
}
}
closedir($dir);

echo output_page(ADMIN_ROOT.'inc/template.html',array('{MENU}'),array($menu));

Line 53 is the one line inside the for() loop. An example *_meta() function is:

function quicklinks_meta()
{
$menu_items = array(
	'Quick Links',
	array('id' => 'home','title' => 'ACP Home','link' => 'index.php?module=home'),
	array('id' => 'newpost','title' => 'New Blog Post','link' => 'index.php?module=newpost'),
	array('id' => 'newpage','title' => 'New Page','link' => 'index.php?module=newpage')
);
}

Anyone?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.