function clean(event)

Hello!

How the “function clean(event)” really works? Ia it totally removes all the objects of the screen from the memory? Is it called automatically in the scene change state?
I am using the command
print(system.getInfo( “textureMemoryUsed” ))
in the first menu screen.
When the application starts the “textureMemoryUsed” is A KB.
After going to screen1 and return in first page, the “textureMemoryUsed” is 2*A KB.
Shouldn’t be A again?

Am I doing something wrong or I have to include any other code for the clean memory process?

Thank you, Fotis. [import]uid: 38658 topic_id: 10069 reply_id: 310069[/import]

may be some of ur objects are global or you had not inserted some objects in the group
it can clear only those objects which are in the group

:slight_smile: [import]uid: 12482 topic_id: 10069 reply_id: 36776[/import]

So, it is called automatically on scene change?

All functions are local. I have some local tables. Must I nil them?
And, when/where I put that code, inside function clean ( event )?

Thank you! [import]uid: 38658 topic_id: 10069 reply_id: 36777[/import]

Director calls clean() only if it exists. You can use this to stop timers and transitions before Director to unload the module.

Sample:

[code]

local vCount = 0

local fTime = function ( event )
vCont = vCont + 1
print(vCont)
end

local vTimer = timer.performWithDelay( 1000, fTime, 0 )

clean = function ()
timer.cancel( vTimer )
end

[/code] [import]uid: 8556 topic_id: 10069 reply_id: 36937[/import]