Memory Leak from Popping Multiple Views

I have noticed a memory leak when popping multiple views on the 920XT watch. It doesn't seem to leak on the simulator.

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
  • Thanks for the report--I'll report this for further investigation. We've been working hard to make sure memory leaks are addressed, but popping multiple views like this wasn't even working on the 920 until the recent 3.20 release, so I could see how this might slip by.
  • Hi Brandon,

    What is the status on this bug fix??? This is a pretty big leak and I'd prefer not to work around it.

    I just tested the leak app above on the Fenix3 and it shows the same memory leak as the 920XT.

    The VivoActive still has the bug where it doesn't pop multiple views like it is supposed to. It does not show a memory leak when I run the leak app on it.

    For watch firmware, I just tested this on
    Fenix3 - 3.20 - LEAKS
    920XT - 3.30 - LEAKS
    Vivoactive - 2.70 - DOESN'T POP MULTIPLE VIEWS

    Just wondering if these bugs might have fallen off of the list because all 3 firmwares have been updated at least a couple of weeks after these were reported.
  • I still have the ticket open, but it's not been investigated yet. We've spent quite a bit of time tracking down and addressing memory leaks, so it's possible this has already been fixed but has not yet been brought into device firmware. I'll push this one up on the list to see if we can get this investigated sooner rather than later.
  • This issue has been addressed as of the Connect IQ 1.1.2 SDK release.