Kitware / itk-vtk-viewer

2D / 3D web image, mesh, and point set viewer using itk-wasm and vtk.js
https://kitware.github.io/itk-vtk-viewer/
BSD 3-Clause "New" or "Revised" License
209 stars 63 forks source link

how clear all work when destroying the viewer #628

Open jonSeetrue opened 1 year ago

jonSeetrue commented 1 year ago

i am a having an memory issue when the viewer is been destroy form the Dom the web-worker are still renaming and when the new viewer is been crated it dose not clear the old one's so if will load and destroy the viewer few time eventuality i will have a memory issue. is there a method of terminate the worker before destroying the viewer?

PaulHax commented 1 year ago

Good point. We can call worker.terminate() on the WebworkerPromises.

Workers are left hanging in a few module globals and elsewhere. https://github.com/Kitware/itk-vtk-viewer/blob/bbfe8a00c72d787b98747e109c29b3cb068203c7/src/IO/MultiscaleSpatialImage.js#L12-L15

Do you have the time to make a PR fix these?

jonSeetrue commented 1 year ago

Hi i will be glad. will try to work on it and will let you know.

On Sat, Dec 31, 2022 at 10:39 PM Paul Elliott @.***> wrote:

Good point. We can call worker.terminate() on the WebworkerPromises.

Workers are left hanging in a few module globals and elsewhere.

https://github.com/Kitware/itk-vtk-viewer/blob/bbfe8a00c72d787b98747e109c29b3cb068203c7/src/IO/MultiscaleSpatialImage.js#L12-L15

Do you have the time to make a PR fix these?

— Reply to this email directly, view it on GitHub https://github.com/Kitware/itk-vtk-viewer/issues/628#issuecomment-1368277378, or unsubscribe https://github.com/notifications/unsubscribe-auth/A42UZFQMEIHQTNQDMEYDSPDWQCKYHANCNFSM6AAAAAATL6UQ5A . You are receiving this because you authored the thread.Message ID: @.***>