Do I need to nil out object function/member function?

Hello,

Below is an example of what I am trying to achieve. Will the code leak? Because I didn’t clear off the function, or do I need to?

-- tap event to remove self local function onTap( event ) event.target:removeSelf() end -- add function local function testAddFunction( obj ) function obj:SayHello() print( "Hello" ) end end -- main local function main() local obj = display.newImage( "man.png" ) testAddFunction( obj ) obj:addEventListener( "tap", onTap ) end

Are you removing the object in another way?  It will leak if the object is never tapped (thus never removed)

In my full code, I did add the obj into a group (self.view under scene:createScene). So it should be destroyed when changing scene.

Are you removing the object in another way?  It will leak if the object is never tapped (thus never removed)

In my full code, I did add the obj into a group (self.view under scene:createScene). So it should be destroyed when changing scene.