It looks like you're new here. If you want to get involved, click one of these buttons!
ParticleFx =gideros.class(Sprite) ---------------- -- CLASS INIT -- ---------------- function ParticleFx:init(t, posX, posY, layer) self.particle = CParticles.new(t, 30, 0.5, 0.3, "alpha") self.particle:setSpeed(350, 450) self.particle:setDirection(-180, 180) self.particle:setColor(0,0,0, 255,255,255) self.particle:setAlpha(0) self.particle:setSizeMorphIn(5, 1.5, 2) self.particle:setGravityForce(0,0) self.particle:setGravity(0,0) self.particle:setAlphaMorphIn(255, 0.2) self.particle:setAlphaMorphOut(0, 0.8) self.particle:setLoopMode(1) self.emitter = CEmitter.new(WIDTH/2, HEIGHT/2, 0, layer) self.emitter:assignParticles(self.particle) layer:addChild(self.emitter) self.emitter:addEventListener("EMITTER_FINISHED", self.onEmitterStop, self) self.emitter:start() end function ParticleFx:onEmitterStop(event) self.emitter:removeEventListener("EMITTER_FINISHED", self.onEmitterStop, self) self.emitter:free() self.emitter = nil self.particle = nil end |
Dislikes: zer0flag
Comments
Likes: anefiox
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
@gianmichele
Did you try to collect garbage manually after niling your emitter on EmitterStop?
And maybe @GregBUG has an idea?
maybe releated with internal lua garbage collector ?
www.tntengine.com
i try to explain...
for example ...
tested... allocated
called some methods and then
called free() methods e no memory leak at all.
ok. it's fine.
but if i use this class (tntMotion) inside another class:
mmmm...
what's wrong here... i can't see... :-?
www.tntengine.com
maybe i missing something important in Lua/Gideros coding at this point...
:-O
www.tntengine.com
Set also enemy=nil
And you can also try setting the container class as weak once you want to delete it, in your example:
yes i'm sure motion:free() returns nil
and i tried to set manually enemy=nil
but not differences...
not tried
enemy = setmetatable({}, {__mode = 'v'})
collectgarbage()
as soon as i go home i'll try.
www.tntengine.com
probably these are "stupid" problems that only me and @gianmichele notice ...
okay. better to move on ...
www.tntengine.com
Or he just probably got fed up of squeking about new platforms as desktop or Windows 8 and decided to pull up couple of all nighters to make that happen
www.tntengine.com
this will help to spread gideros sdk!!
if can can remember correcly last email newsletter from gideros is from last christmas right?
hey but where is @gorkem ? :P
Likes: gorkem
www.tntengine.com