NASA-AMMOS / 3DTilesRendererJS

Renderer for 3D Tiles in Javascript using three.js
https://nasa-ammos.github.io/3DTilesRendererJS/example/bundle/mars.html
Apache License 2.0
1.57k stars 281 forks source link

Aborted tiles leave remaining ImageBitmaps #545

Closed gkjohnson closed 4 months ago

gkjohnson commented 4 months ago

When tile loads are aborted after they've downloaded but before they've finished parsing the image bitmap textures are not released.

See here

Texture custom plugin / texture disposal will need the same callback - should add an "aborted" callback / event for handling this.

gkjohnson commented 4 months ago

One issue is that we need to not assign the fields to the object at all if the request has been aborted else we risk the case where it might be downloaded twice, the second request finishes first and gets deleted by the abort callback for the first. Perhaps it's best to pass the "abort" object into the the parse function so it can react accordingly.

gkjohnson commented 4 months ago

Tile contents are already disposed on abort:

https://github.com/NASA-AMMOS/3DTilesRendererJS/blob/0c29c839749cf278c18684769dbe4a9066a4bcf1/src/base/TilesRendererBase.js#L437-L450