Questions about garbage collection

First off is this a memory leak or just expected behavior…  I have a menu scene using composer and then a drill scene.  Going back and forth between the two looks like this in the memory.

Menu Entry - 326.03 KB (menu is never removed since it will be visited often)

Drill - 397.827 KB

Menu - 359.384 KB (drill scene is removed every time and I attempted to clean up the best i can)

Drill - 398.471 KB

Menu - 359.646 KB

Drill - 398.732 KB

Menu - 359.907 KB

So it appears there is a slight creep happening but it’s small so i wasnt sure if this is just normal behavior or if i missed something in my cleanup. 

Also, if i add display objects to the scene’s view do i still have to manually remove them?  It was my understanding that removing the scene also cleaned up the views objects?

Hi @smeyer2,

If the memory continues to climb slowly, and never drops back down, then you have a leak and you should find/fix it. While you don’t need to remove display objects that are part of a scene, you need to clean up other elements which might be preventing proper garbage collection. This includes things like canceling timers and transitions, removing Runtime event listeners, stopping and discarding audio, etc.

Hope this helps,

Brent

Hi @smeyer2,

If the memory continues to climb slowly, and never drops back down, then you have a leak and you should find/fix it. While you don’t need to remove display objects that are part of a scene, you need to clean up other elements which might be preventing proper garbage collection. This includes things like canceling timers and transitions, removing Runtime event listeners, stopping and discarding audio, etc.

Hope this helps,

Brent