emerald icon indicating copy to clipboard operation
emerald copied to clipboard

Memory Leaking

Open Bombfuse opened this issue 3 years ago • 2 comments

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.

Bombfuse avatar Oct 02 '20 04:10 Bombfuse

Add an Arc to FontKey and TextureKey

Remove font and texture storage in rendering engine

Bombfuse avatar Dec 06 '20 00:12 Bombfuse

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);

Bombfuse avatar Dec 18 '20 20:12 Bombfuse

fixed in https://github.com/Bombfuse/emerald/pull/238

Bombfuse avatar Apr 01 '23 01:04 Bombfuse