It looks like you're new here. If you want to get involved, click one of these buttons!
collectgarbage() s = collectgarbage("count") --emittersInit() --particlesInit() local particleGFX = (Texture.new("gfx/smoke.png")) --emitter1 = emittersCreate("emitter1", 160, 240, 0, stage) --test1 = particlesCreate("test1", particleGFX, 50, 3) u = collectgarbage("count") --emittersFree() --particlesFree() --emitter1 = nil --test1 = nil particleGFX = nil collectgarbage() e = collectgarbage("count") print("----- Memory Userd: "..(u*1024).." bytes") if e-s > 0 then print("----------- MEMORY LEAK: "..((e-s)*1024).." bytes") else print("----------- MEMORY OK") end |
Comments
Plug I am not sure if somethign is collected right away with a collectgarbadge directly after the nil, maybe it is. Try to define these global variable up front before the frist counting.
But I wouldn't bother much with those small leaks honestly, as long as they don't get out of hand.
Just avoid the use of globals as much as you can d:
i tried to define s,u,e before first counting but is the same always 48 bytes lost...
removed u variable and always 48 bytes lost...
all my code (commented in this test) work fine and no memory leak...
but when i add the line
could be that i wrong free the texture ?
or the garbage collector that works different and defers the release of "particleGFX" ?
www.tntengine.com
So problem seems definitely calling collectgarbage right after nilling.
thanks!!!
www.tntengine.com
Don't worry, I run here with same question
http://www.giderosmobile.com/forum/discussion/404/can-cyclic-reference-cause-memory-leaks#Item_3
Yes, i'm a little bit paranoic! :P
www.tntengine.com