memory leak with movieclip

In my app I create a set of bad guys using a class.

When i create them as a still image everything runs fine; however when I replace the image with a movieclip I get a leak.

When they are created I use the code:

 dude = movieclip.newAnim{ "zombie1.png", "zombie1.png", "zombie2.png", "zombie2.png", "zombie3.png", "zombie3.png" }  
 dude:play{ startFrame=1, endFrame=30, loop=0, remove=true }  
 dudes[#dudes+1] = dude  
 physics.addBody(dude, { isSensor = true })  

They are moved by:

dude:removeSelf()  
dude2=nil  
dudes[i] = nil  

Is there something I have to modify in the movieclip.lua file to remove them properly? [import]uid: 10903 topic_id: 7882 reply_id: 307882[/import]

More on this:

Even when I’m not using a class system to create the movieclips and use just a looping timer instead I get a leak. Clearly there is a specific way to remove them that I’m missing, anyone know about this?

[code]

local movieclip = require(“movieclip”)

local background = display.newRect(0,0,640,960)

local function memCheck (event)

collectgarbage(“collect”)
print("System Memory : "…collectgarbage(“count”))
end

local timerCheck = timer.performWithDelay( 50, memCheck, -1 )

local function myanimspawn()

local myAnim = movieclip.newAnim{ “zombie1.png”, “zombie1.png”, “zombie2.png”, “zombie2.png”, “zombie3.png” }
myAnim.x = 100
myAnim.y = 100
myAnim:play{ startFrame=1, endFrame=30, loop=2, remove=false }

local function removeall()
myAnim:removeSelf()
myAnim = nil
print(“removed”)
end

transition.to( myAnim, { time=1000, alpha=1, x=150, y=810, onComplete = removeall } )
end

timer.performWithDelay(100, myanimspawn, 20)

[/code] [import]uid: 10903 topic_id: 7882 reply_id: 27994[/import]

Also in the above code setting remove to equal true does not help. [import]uid: 10903 topic_id: 7882 reply_id: 27995[/import]

i would imagine both the enterframe listener and the images you loaded are still hanging around in memory. really movieclip.lua probably needs a destroy function. [import]uid: 6645 topic_id: 7882 reply_id: 28239[/import]