I made a simple project that shows the leak. It's a main view that calls up a menu and item 1 calls a submenu and item 3 calls a special menu view. It pops the menu and the submenu when it pushes the special menu view. I can email someone the project if that would be helpful.
The goal of popping the 2 menu pages is to free up the approximately 5K of memory that they use.
class LeakMenuDelegate extends Ui.MenuInputDelegate {
function onMenuItem(item)
{
if (item == :item_1)
{
Ui.pushView(new Rez.Menus.SubMenu(), new LeakMenuDelegate(), Ui.SLIDE_UP);
}
else if (item == :item_2)
{
Sys.println("item 2");
}
else if (item == :item_3)
{
Ui.popView(Ui.SLIDE_IMMEDIATE);
Ui.popView(Ui.SLIDE_IMMEDIATE);
Ui.pushView(new MenuView(), new MenuViewDelegate(), Ui.SLIDE_UP);
}
else if (item == :item_4)
{
Sys.println("item 4");
}
}
}
The memory used grows about 2400 bytes every time it's called. The following lines in the special menu view produces the following output when the menu selections are made to get to the special menu view several times in a row.
function onShow() {
stats = Sys.getSystemStats();
Sys.println("Used: " + stats.usedMemory);
}
2 Ui.PopViews
Used 27248
Used 29720
Used 32200
Used 34672
Used 37144
Used 39600
If I comment out the 2 popViews and use the back key to get back to the Main View the leak doesn't seem to be there.
2 Ui.PopViews Commented Out
Used 27192
Used 27208
Used 27208
Used 27208
Used 27208
Used 27208
Used 27208