[wp-trac] [WordPress Trac] #21672: Custom menu memory problem

WordPress Trac wp-trac at lists.automattic.com
Thu Aug 23 18:53:46 UTC 2012


#21672: Custom menu memory problem
--------------------------+-----------------------------
 Reporter:  pavelevap     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Menus         |    Version:  3.4.1
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 I found some strange memory problem related to updating custom menu. One
 website is using about 22 MB from 128 available (memory_limit). But when
 trying to update custom menu, there is error related to unsufficient
 memory.

 This custom menu has about 100 items, I also tried to export it to my PC
 and testing memory uasge. There are some strange results...

 In file wp-admin/nav-menus.php there is following line:

 {{{
 $menu_item_db_id = wp_update_nav_menu_item( $nav_menu_selected_id, (
 $_POST['menu-item-db-id'][$_key] != $_key ? 0 : $_key ), $args );
 }}}

 When I set memory checks before and after this line, then there are
 following results on my testing environment, for example:

 {{{
 Before: 25.28 MB
 After: 25.29 MB
 }}}

 I added also some checks directly into wp_update_nav_menu_item() function
 and there are some small peaks (about 1 MB). But in the end (after this
 function) everything is somehow reset and memory usage is as low as in the
 beginning.

 But when I test it with affected hosting, there are following results:

 {{{
 Before: 26.59 MB
 After: 27.77 MB
 }}}

 So everytime wp_update_nav_menu_item() is running, 1 MB more is needed on
 this server and there is no reset. And because it is foreach cycle and
 menu has more than 100 items, then more then 128 MB is needed.

 Same conditions, but one server needs more than 128 MB memory_limit and my
 local environment works well with 32 MB. There is no other problem with
 this hosting, everything works, no special server settings. Any ideas?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21672>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list