Closed eyal-katz closed 8 years ago
Well, it's not a problem for every Canvas object, only for those that are not disposed by the developer - which he/she should always do, anyway. :wink: But you're right, of course: the reason I'm using the other kind of listener in the other classes also applies here. I'll make that change!
Thanks a lot for the heads-up!
Canvas.dispose() does not remove the listener, so I think it happens for every Canvas... am I wrong?
(Daniel, I will write a song about you one day, it will be an ode with a lot of brave words in it...)
Eyal, you're completely right! With that other line missing, this does cause memory leaks. I should have checked that right away!
In any case, a fix will be coming right away - no need for a song just yet! :wink:
Hey
Checkout Canvas.as, line ~65 (Starling v1.8) You will see:
Starling.current.addEventListener(Event.CONTEXT3D_CREATE, onContextCreated);
Where it should listen to stage 3d with weak references (like other starling display classes):
Starling.current.stage3D.addEventListener(Event.CONTEXT3D_CREATE, onContextCreated, false, 0, true);
This bug currently causes every Canvas ever created to be kept in memory....
Eyal