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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.