Its me again
I build a few elements for a planned game, like a Gui (buttons, onclick functions, and so on). At the moment i try to debug some leaks in my programm.
Heres some codesnippet, that dont work really nice:
- Code: Select all
- function TGuiButton:makeHover(gui, lastPicked)
- function deleteHover(hover)
- -- print(hover)
- hover.gui.layer:removeProp(hover.prop)
- hover.prop = nil
- hover = nil
- end
- for i,_frm in pairs(lastPicked.frame) do
- local prop = _frm.prop
- local x,y = prop:getLoc()
- local sx,sy = prop:getScl()
- local index = prop:getIndex()
- local frm2 = gui:addFrame(prop.deck,x,y,index)
- frm2.prop:setScl(sx,sy)
- local prio = prop:getPriority()
- frm2.prop:setPriority(prio+0.1)
- frm2.prop:setBlendMode(MOAIProp2D.BLEND_ADD)
- --self.lastPicked.hover = frm2
- frm2.prop:setColor(1,1,1,0.5)
- local action = frm2.prop:seekColor(1,1,1,0,1)
- action.gui = gui
- action.prop = frm2.prop
- action:setListener(MOAIAction.EVENT_STOP, deleteHover)
- end
- end
lastPicket is a TGuiButton object, thats under the mouse.
When a click is performed, this code is launched. It makes a copy of the Props that the Button contains (in the most times, its just one frame / prop).
The blend is a simple addition, to make a lighten-effect.
After the fadeout (seekColor to an alpha value of 0) it should be deletet.
Now, i got some buttons, that print several values.
One uses MOAISim.reportHistogram.
Here i can see, that each time i click the button, the MOAIEasedriver-count and MOAIProp count gets plus one. So, i guess this hovering-prop never gets deletet.
When i use the MOAISim.forceGarbageCollection(), the game laggs like hell.
Is there a good way, to delete Props and Easedrivers when i dont need them anymore? Because i use Easedrivers very often
I tryed to give the program some time, so i started it and walk in the garden for ~ 1hour - after that period of time, there was a huge ammount of unused ease drivers (somthing arround 20k+) - thats probably a huge performance loss :-/
(ps: Sorry again for my bad english

