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
210 stars 64 forks source link

close all workers when process is done #661

Open jonSeetrue opened 1 year ago

jonSeetrue commented 1 year ago

Fix the memory leak issue. close all workers when done processing.

jonSeetrue commented 1 year ago

Hi @banesullivan This pr fixes the memory issues of the open workers, could you review it, please?

banesullivan commented 1 year ago

Hi @jonSeetrue, I'm not an active developer or maintainer of this software nor am I familiar with the exact issue referred to here, so I don't think I'm the right person to review this.

Though, as a member of the user community, I think I can speak for everyone in saying thank you for this contribution and likely impactful fix!

jonSeetrue commented 1 year ago

@thewtex do you mean to collect all the workers into an array on the viewer object and when loading a new image call terminateWorkers()?

thewtex commented 1 year ago

@jonSeetrue a cleanup() function on the viewer that calls terminateWorkers() on the worker pools when called. Loading a new image will not need a call. I am not sure if an array on the viewer object is needed.

jonSeetrue commented 1 year ago

@thewtex the worker-pool is not exported, so should the cleanup() function be part of each worker-pool implementation?

thewtex commented 1 year ago

@jonSeetrue yes, that could work :+1: