We load a lot on images in lazy load.
How we can release the memory and remove that image from it?
It should be pic.dispose().
We are looking at it now, and it is not working. We think we have tracked it down to the id of the bitmap for the pic is not the same as the id for the pic. The pic id is the filename - or path and filename, depending - but the bitmap id is a number like 3. So it is not finding and removing the pic in the ZIM.assets array.
We will look into that later tonight or tomorrow and most likely patch ZIM 018.
We have added a destroy() method to Pic().
Normal dispose() on a Pic() will just dispose the specific container and cloned bitmap leaving the original HTML image reference and ZIM Bitmap so that more Pic objects can be made from the loaded image.
destroy() will dispose the original ZIM Bitmap and set references to the HTML image to null letting HTML clear the image from memory.
let pic = new Pic("https://zimjs.org/assets/ai_alienplanet01.jpg").center();
timeout(2, ()=>{
pic.destroy()
zog(zim.assets["https://zimjs.org/assets/ai_alienplanet01.jpg"])
zog(zim.assets)
zog(pic.image)
pic = null;
S.update();
});
This is patched into ZIM 018 - let us know how it goes.
Great!!! Thanks!
I thinks we need same function for Aud