emerald
emerald copied to clipboard
Memory Leaking
This has been a problem since the beginning of the project. Whenever an asset is loaded, it is never release.
Need to find a way to count the number of reference to an asset in the cache, then release it when there are no references to it.
This should ideally not break the current Api, where a user is able to clone handles to textures and sounds.
Add an Arc to FontKey and TextureKey
Remove font and texture storage in rendering engine
Because loading can only happen the through the AssetLoader and requires caching for performance and UX reasons, it's not possible to give the user an Arc wrapper.
Alternative is to allow the user to clear the cache manually via
emd.cache().clear();
emd.cache().clear_font(font_key);
emd.cache().clear_texture(texture_key);
emd.cache().clear_audio(audio_key);
fixed in https://github.com/Bombfuse/emerald/pull/238