kiigame / kged

A game editor for the KiiGame Adventure Engine
https://kged.netlify.com
BSD 3-Clause "New" or "Revised" License
1 stars 6 forks source link

Asset objectURL memory leak (on import) #28

Open evktalo opened 4 years ago

evktalo commented 4 years ago

Loaded assets (images/audio) are not released/revoked when importing a new project. This can be easily reproduced by importing large projects multiple times in a single tab and observing the memory usage.

Right now it's not a big (or even noticeable) issue unless the user imports huge projects multiple times within a session.

This can most likely be fixed by revoking each existing objectURL (with window.URL.revokeObjectURL) when importing a project (since they wont be accessible in the UI anymore). It would be nice if all objectURLs in the window object could be revoked with a single call but we couldn't determine if it's supported.

More background info here: https://w3c.github.io/FileAPI/#lifeTime