storyboard and memory not returning to origional level

I have a simple test app with scene1 and scene2. Each scene has an image representing a button which I click to go to the other scene.

When scene one loads I check the memory usage. I then switch to scene2 and then back to scene1. I check the memory usage again and it has increased. Am I wrong to expect it to have returned to the origional value?

I am purging scenes and as far as I am aware removing and niling everything.

If you flick back and forth a few times does it continue going up or is it stable?

It gets to a stable level so there isn't a growing leak as such. I just wondered why it doesn't return to the origional level.

I am going through my app at the moment trying to remove leaks and to be honest I am failing to get a grip on the whole releasing memory thing.

This may provide an interesting/helpful read for you; http://blog.anscamobile.com/2011/08/corona-sdk-memory-leak-prevention-101/

Peach :)

Thanks Peach, I think I am doing everything in the article but I must be missing something.

I found that printing out the modules loaded in the unrequire function quite enlightening. It also helped me track down one leak where my level modules were not unloading.

1
2
3
4
5
        function unrequire(m)
                package.loaded[m] = nil
                _G[m] = nil             
                table.foreach(package.loaded, print)
        end

One way to handle this might be to make a new project, add a few things then switch to a new scene and back again. No leak? Add some more things. (Visuals, timers, variables, etc.)

It may be a way of isolating an area you aren't getting yet.

That said depending on the size of the leak it could safely be ignored, perhaps - it really depends. It's better to get rid of them but if it is small enough leaving it as it is may be OK, too. (I'm not encouraging this as such, only saying it isn't something worth driving yourself nuts over if it is minor.)

Peach :)

views:2282 update:2012/2/12 11:34:30
corona forums © 2003-2011