I hava two scenes and main.lua
--main.lua local storyboard = require "storyboard" display.setStatusBar(display.HiddenStatusBar) storyboard.gotoScene( "Scene.test" ) storyboard.isDebug = true
in test.lua, I creat a button which can goto another scene named "dict
--test.lua local storyboard = require("storyboard") local widget = require( "widget" ) local scene = storyboard.newScene() -- Clear previous scene storyboard.removeAll() function scene:createScene( event ) storyboard.printMemUsage( ) local group = self.view local function handleButtonEvent( event ) if ( "ended" == event.phase ) then storyboard.printMemUsage( ) storyboard.gotoScene("Scene.dict") end end -- Create the widget local button1 = widget.newButton { left = 100, top = 200, id = "button1", label = "dict", onEvent = handleButtonEvent } group:insert(button1) end function scene:enterScene( event ) local group = self.view end function scene:exitScene( event ) local group = self.view end function scene:destroyScene( event ) local group = self.view end scene:addEventListener( "createScene", scene ) scene:addEventListener( "enterScene", scene ) scene:addEventListener( "exitScene", scene ) scene:addEventListener( "destroyScene", scene ) --------------------------------------------------------------------------------- return scene
in dict.lua, I will read some data from my database and show it , and same as test.lua, I create a button which can goto scene “test”
I keep click the button and change scene between “test” and “dict”, and System Memory Used keep increase.
what I am thinking is that storyboard.removeAll() will remove not only the display objects but also the system memory I have used
but it seems didn’t ?
If I remove the line “storyboard.removeAll()” in both test.lua and dict.lua, system memory are keeping the same value. but it is not what I want
I want every time entering the scene, it can be a new scene(not in the previous state)
how can I clean those system memory?