On Device suspend / resume - small memory leak?

Greetings, me again…

I have this strange memory leak that only occurs when I suspend device (hit home to exit out of App) then when I return to it, there’s a discrepency in memory (+2 kbs)… While it’s a small number, it won’t go back down and continue to climb each time I suspend.

I’ve tested my App and the memory does not leak otherwise.  Is this normal or bug or ???

Anyone else have seen or heard of this?

I’ve tried pausing it when it goes ‘onSuspend’ but nothing seems to help it.  I’ve even deleted most of my objects and timers just as a test but the memory still creeps up each time when hit home button to suspend.

Any info?  Thanks

** Edit - I’m testing it on an iphone 5, ios 8 device **  Also , the memory doesn’t leak in the simulator but when it’s on the device it will (only on suspend/resume)

Hi @henson802,

This sounds like some kind of memory leak (if it won’t go back down and continues to creep upward). Are you sure you’ve stopped/paused everything that should be? Timers, transitions, sprite animations? Are you using audio?

As a comparison, you could try loading our sample project “System Events”, add the typical memory monitor block (I assume you located the one that most people use), have that function display the result to the screen, install the app on your device, and try exiting in and out of the app multiple times.

CoronaSDK > SampleCode > Hardware > SystemEvents

Take care,

Brent

@Brent Sorrentino

*** I just did your SYSTEM EVENTS demo - and it was doing the same thing, memory creeping up every time I suspended and resumed on device… so that’s a relief it’s not my code  ;)   -

ok it takes a handful of suspends before it levels out , I’ll keep seeing what I can do… thanks

Edit2 - I been testing my game and I still can’t seem to find why it ONLY leaks 2KBs when I suspend and return.  There’s only two scenes, and if I stay within the App, no leak.  Furthermore, even if I suspend from the Main menu, which is only like 3 or 4 graphics, plus a button, it still leaks.

The only difference that SAMPLE code has is that it doesn’t use Composer.  I’d wonder if I used a SAMPLE Project that had Composer involved, if this would show what I’m experiencing.

I’ve about run out of ideas.


Yeah I have everything paused… Well currently I have onSuspend function trigger an overlayScene (pause) which pauses timers, transitions, animations, on creation.  I am not using audio at the moment.  At one point, I had the onSuspend directly delete all timers except the Memory Monitor just to see, and it was still leaking 2kbs on resume.

IF I go to the pause menu from in game, and back… memory will go back down to the same place each time.  But even when I’m in the actual pause menu, then decide to suspend, and then resume… I’m in pause menu still, but when I resume from there, the memory is 2kbs higher because I suspended.  But wouldn’t be if I didn’t suspend.  I’m quite puzzled!

If I stay in the game, and go from scene to scene and play multiple times - the memory remains steady… no leak.  No matter what I try to do as long as I don’t suspend and resume…

What’s strange is the simulator, when I suspend that, and come back - there is no memory leak.  Only occurs on the actual device.

Hi @henson802,

This sounds like some kind of memory leak (if it won’t go back down and continues to creep upward). Are you sure you’ve stopped/paused everything that should be? Timers, transitions, sprite animations? Are you using audio?

As a comparison, you could try loading our sample project “System Events”, add the typical memory monitor block (I assume you located the one that most people use), have that function display the result to the screen, install the app on your device, and try exiting in and out of the app multiple times.

CoronaSDK > SampleCode > Hardware > SystemEvents

Take care,

Brent

@Brent Sorrentino

*** I just did your SYSTEM EVENTS demo - and it was doing the same thing, memory creeping up every time I suspended and resumed on device… so that’s a relief it’s not my code  ;)   -

ok it takes a handful of suspends before it levels out , I’ll keep seeing what I can do… thanks

Edit2 - I been testing my game and I still can’t seem to find why it ONLY leaks 2KBs when I suspend and return.  There’s only two scenes, and if I stay within the App, no leak.  Furthermore, even if I suspend from the Main menu, which is only like 3 or 4 graphics, plus a button, it still leaks.

The only difference that SAMPLE code has is that it doesn’t use Composer.  I’d wonder if I used a SAMPLE Project that had Composer involved, if this would show what I’m experiencing.

I’ve about run out of ideas.


Yeah I have everything paused… Well currently I have onSuspend function trigger an overlayScene (pause) which pauses timers, transitions, animations, on creation.  I am not using audio at the moment.  At one point, I had the onSuspend directly delete all timers except the Memory Monitor just to see, and it was still leaking 2kbs on resume.

IF I go to the pause menu from in game, and back… memory will go back down to the same place each time.  But even when I’m in the actual pause menu, then decide to suspend, and then resume… I’m in pause menu still, but when I resume from there, the memory is 2kbs higher because I suspended.  But wouldn’t be if I didn’t suspend.  I’m quite puzzled!

If I stay in the game, and go from scene to scene and play multiple times - the memory remains steady… no leak.  No matter what I try to do as long as I don’t suspend and resume…

What’s strange is the simulator, when I suspend that, and come back - there is no memory leak.  Only occurs on the actual device.