I'm investigation some memory leaks into a custom wordpress theme . I noticed that the first menu displayed (for mobile) - eats around 7mb.
this is the mobile menu code (hidden for resolutions under x px)
print number_format(memory_get_usage()).'</br>';
wp_nav_menu( array(
'theme_location' => 'mobile',
'container' => false,
'menu_class' => 'mobilex-menu',
) );
print number_format(memory_get_usage()).'</br>';
displays
37,299,320
44,254,368 - around 7mb used!!!
After the mobile menu i show a normal web menu in primary location.This is the "default" menu code
print number_format(memory_get_usage()).'</br>';
wp_nav_menu( array(
'theme_location' => 'primary' )
);
print number_format(memory_get_usage()).'</br>';?>
shows 44,317,656
44,553,176 -
If i remove the mobile menu code the default menu script prints 37,367,472 44,300,472 - around 7mb
Is it normal for wordpress wp_nav_menu() to take around 7mb of memory for showing a menu ? Can i lower the memory usage for it ? For the above tests i used the same 2 level menu for both locations. Thanks
Aucun commentaire:
Enregistrer un commentaire