I have an application which has to handle lots of different KTX2 compressed textures.
When providing all textures in one GLB file (about 20MB) many devices crash while loading the GLB.
The error messages differ between various browsers but it always seems to related to memory size.
This is what Chrome reports:
So I tried to split the textures up into various GLB files and always just load the ones, that are required for the current state of the app.
Before switching to a different GLB I want to clear the scene, so that the previously loaded textures get disposed and there is enough memory for the new ones.
However this doesn’t seem to work that way, because after some loading cycles the devices crash again with the same error messages.
It seems like the memory is still occupied by previously loaded textures.
I made a repro which just adds a GLB to the scene and immediatly disposes the scene afterwards.
When running that code in a loop I would expect that this could go on forever, since all the ressources of the old scene are disposed, before adding new textures.
The loop runs about 5 times on my machine in Chrome.
IOS devices crash already at the 2nd / 3rd time.
Am I missing something, or is there a better way to release the scene ressources?