OHIF / Viewers

OHIF zero-footprint DICOM viewer and oncology specific Lesion Tracker, plus shared extension packages
https://docs.ohif.org/
MIT License
3.29k stars 3.32k forks source link

Volumes and image data are never decached #559

Closed swederik closed 1 year ago

swederik commented 5 years ago

This is a pretty bad issue. We have no ability to remove a volume from the cache.

https://github.com/OHIF/Viewers/blob/24a8d7bca2e8daa119da324fc46595418013892e/extensions/ohif-vtk-extension/src/OHIFVTKViewport.js#L36-L37

Similarly, we have the image data cache which is also never cleared (and is stored in react-vtkjs-viewport library):

https://github.com/OHIF/react-vtkjs-viewport/blob/3b48f4a7141b3e95353d5d1649e2c2af5f579ecd/src/lib/getImageData.js#L8-L15

We need to unify this stuff somewhere. We also need to add some ability to know when we are no longer displaying a volume anywhere so we can decache it. I've added an onDestroyed function prop here (https://github.com/OHIF/react-vtkjs-viewport/blob/master/src/VTKViewport/View2D.js#L82) but it isn't used anywhere yet.

sedghi commented 1 year ago

@jbocce Can you validate this if still happens? and close if not valid anymore

jbocce commented 1 year ago

After calling cornerstone.cache.purgeCache(), the heap snapshot is significantly less.