allen-cell-animated / volume-viewer

https://allen-cell-animated.github.io/volume-viewer/
Other
90 stars 7 forks source link

fix memory leak #141

Closed toloudis closed 11 months ago

toloudis commented 11 months ago

Fixes a memory leak.
Reproduce:

  1. select a time series and play through time (repeatedly)
  2. either observe an eventual performance degradation and exception, or observe the javascript heap graph growing using devtools profiler.

The fix is to use threejs's dispose in key places that hold references to the data textures that contain the volume pixels.

An alternative future code path was already presented in a TODO comment: allocate the Materials to be used in gpuFuse as members of Channel, so that they can be encapsulated alongside their DataTextures and created/destroyed in the same place.