CSC510-2015-Axitron / maze

Main repo for maze game
0 stars 2 forks source link

Source of memory leaks found #91

Closed macluo closed 9 years ago

macluo commented 9 years ago

While working on a new branch related to CanvasEngine f068e37024d8bafc613128712f6b93a4a5e174c8, it was discovered that Canvas from previous level has not been released from the memory. This has something to do with how mazeMenu calls load() & inject() in AMaze.model when loading the canvas. Any insight on the workaround?

In the newButtonWorks branch, a variable has been registered in the render() method of canvas, which is supposed to print "loop" 3 times per second in the console. When multiple canvas exists, the number of messages piles up.

macluo commented 9 years ago

FYI. A workaround is being attempted to rearrange canvas in setGameCanvas() of mazeMenu.js

duh102 commented 9 years ago

It's because you make a new canvasengine every time you load, if you change it so that the canvasengine loads from a maze variable instead of doing the var modelTest = loaded; bit, then I think you should be able to call scene.ready() and it'd re-render everything. I could be very wrong though, I haven't looked it over extensively.

macluo commented 9 years ago

Thanks. I will get on it after lunch.

macluo commented 9 years ago

It looks like the canvas itself is fine but the events registered by the render() method of CanvasEngine doesn't get released from the memory and therefore when a new canvas is instantiated the same events get loaded over and over again. If this is the case it could be the bug of CanvasEngine itself.

macluo commented 9 years ago

Fixed in e920c41b7936ad35764b52655d7ea2a8077d1fe9. Will close it once QA is done.

macluo commented 9 years ago

Ended up not using CanvasEngine's render() method at all. Closed for now. 3951203ea4a2e545f857a3cbc49021c2152ba1d0