I’m using
[lua]
local function checkMemory()
collectgarbage( “collect” )
local memUsage_str = string.format( “MEMORY = %.3f KB”, collectgarbage( “count” ) )
print( memUsage_str, "TEXTURE = "…(system.getInfo(“textureMemoryUsed”) / (1024 * 1024) ) )
end
timer.performWithDelay( 1000, checkMemory, 0 )
[/lua]
in my main.lua file and in the Simulator it’s showing about 400KB with my opening Menu scene.
If I click on another scene called “vowels” it goes to about 470KB.
I jump back to the Menu Scene and it goes to 479KB. Let’s forget the fact I have a memory leak for a moment (of about 4KB every time I go back and forth between two scenes).
I just want to understand: if I have unloaded in “vowels” scene:destroy all of my audio files and widgets group, then _ 479KB should go back to roughly 400KB, should it not? _
Is that what scene:destroy should do - free up most of the memory that was taken by scene:create.
Just trying to understand how this works because it’s never worked that way for me. (I’ve read Rob Miracle’s article: http://coronalabs.com/blog/2013/04/02/cleaning-up-display-objects-andlisteners/ but wasn’t entirely clear about this.)
Thanks for any clarification you can provide.