Any reason not to storyboard.purgeAll() after each transition?

I’ve spent weeks tracking down a memory leak that I’ve ended up solving by simply removing the previous storyboard scene with the storyboard.removeScene() function (I’m not sure why this was the fix as I had expected a low memory state to automatically remove low use scenes)

I’m working on a game that will allow the player to transition to and from many different scenes (able to come and go to the same ones many times). Is there any reason not to just build in a storyboard.purgeAll() on the enter scene event of each scene? Since each scene is self contained recreating it each time it’s called shouldn’t be a problem should it?

What types of games/apps would you not want to create and destroy scenes on a one by one basis?

Thanks for any insights anyone can share, I’m trying to better understand how to get the most out of the Storyboard API. [import]uid: 105707 topic_id: 31734 reply_id: 331734[/import]

I don’t like waiting on a low memory warning to purge old scenes. First it doesn’t work well on Android. Secondly on iOS you’re likely to get killed before the purge is complete anyway.

The problem with purging is you need to do it after the next scene is fully loaded or you will feel the slowdown. Purging is slow and time consuming and it shows up as sluggishness.
[import]uid: 19626 topic_id: 31734 reply_id: 126726[/import]

Hi Rob,

I appreciate the input. On my old iPad that I test on it bogs the hardware to the point of being nearly non responsive and apparently doesn’t purge the scenes automatically.

My strategy moving forward is to remove each previous scene after the new scene has loaded.

You mention that Purging is slow and time consuming. If I’m doing each scene one at a time, is there any disadvantage to purgeAll() over removeScene()?

It looks easy enough to set up a system that gets and stores a scene name in order to remove it on the next scene.

Thanks for your help :slight_smile: [import]uid: 105707 topic_id: 31734 reply_id: 126799[/import]

I don’t like waiting on a low memory warning to purge old scenes. First it doesn’t work well on Android. Secondly on iOS you’re likely to get killed before the purge is complete anyway.

The problem with purging is you need to do it after the next scene is fully loaded or you will feel the slowdown. Purging is slow and time consuming and it shows up as sluggishness.
[import]uid: 19626 topic_id: 31734 reply_id: 126726[/import]

Hi Rob,

I appreciate the input. On my old iPad that I test on it bogs the hardware to the point of being nearly non responsive and apparently doesn’t purge the scenes automatically.

My strategy moving forward is to remove each previous scene after the new scene has loaded.

You mention that Purging is slow and time consuming. If I’m doing each scene one at a time, is there any disadvantage to purgeAll() over removeScene()?

It looks easy enough to set up a system that gets and stores a scene name in order to remove it on the next scene.

Thanks for your help :slight_smile: [import]uid: 105707 topic_id: 31734 reply_id: 126799[/import]

Hey EHO.

You can set this flag to purge each previous scene automatically for you:

http://docs.coronalabs.com/api/library/storyboard/purgeOnSceneChange.html [import]uid: 84637 topic_id: 31734 reply_id: 127128[/import]

Hey EHO.

You can set this flag to purge each previous scene automatically for you:

http://docs.coronalabs.com/api/library/storyboard/purgeOnSceneChange.html [import]uid: 84637 topic_id: 31734 reply_id: 127128[/import]

In which file to set this flag? main.lua?

thank you [import]uid: 31508 topic_id: 31734 reply_id: 128268[/import]

main.lua is a good place to set it though it pretty much could be put anywhere. [import]uid: 19626 topic_id: 31734 reply_id: 128283[/import]

Thanks for the heads up on the flag Danny! I knew you guys must have a straightforward way of handling this :slight_smile:

Thanks to Rob for the reminder that it only needs to be set once… for some reason I had it in my mind that I needed it in each scene :0
[import]uid: 105707 topic_id: 31734 reply_id: 128294[/import]

In which file to set this flag? main.lua?

thank you [import]uid: 31508 topic_id: 31734 reply_id: 128268[/import]

main.lua is a good place to set it though it pretty much could be put anywhere. [import]uid: 19626 topic_id: 31734 reply_id: 128283[/import]

Thanks for the heads up on the flag Danny! I knew you guys must have a straightforward way of handling this :slight_smile:

Thanks to Rob for the reminder that it only needs to be set once… for some reason I had it in my mind that I needed it in each scene :0
[import]uid: 105707 topic_id: 31734 reply_id: 128294[/import]