CaPTk icon indicating copy to clipboard operation
CaPTk copied to clipboard

CaPTk hogs memory

Open ashishsingh18 opened this issue 5 years ago • 5 comments

Description: CaPTk hogs memory

Steps to reproduce the behavior:

  1. Load an image in CaPTk (ex: http://www.dclunie.com/pixelmedimagearchive/upmcdigitalmammotomocollection/index.html )
  2. Open Task Manager and see memory usage
  3. Load the same image in MITK and check memory usage

Screenshots: Please see the screenshots when 1 image of 1GB was loaded into CaPTk vs MITK

image

image

CaPTk Version: 1.7.3

OS: Windows 10

ashishsingh18 avatar Jan 14 '20 04:01 ashishsingh18

(note that in the screenshot it just reaches the maximum of the system. With an 1GB image in a 32GB machine it reached 20GB+ of memory usage)

dboun avatar Jan 14 '20 04:01 dboun

@dboun 20GB was in Debug mode

ashishsingh18 avatar Jan 14 '20 16:01 ashishsingh18

I think a big reason behind this is the fact that CaPTk always loads images as Floats whereas MITK does not. And that is done on CaPTk to facilitate easier computation and not having to cast. In any case, this is simply a no-go but I am not sure if this is something we want to tackle now.

sarthakpati avatar Jan 14 '20 16:01 sarthakpati

I think a big reason behind this is the fact that CaPTk always loads images as Floats

I don't think that float images can make memory usage get to 20x+ the image size. It's probably because multiple copies are generated somehow.

@dboun 20GB was in Debug mode

Yes, but it was maxed out on the 32GB system too. It could have been more

dboun avatar Jan 14 '20 17:01 dboun

We can't be tackling this now. It needs a lot of refactoring. But perhaps when we are all looking at adding new code or fixing bugs, it might be better to also keep the memory footprint in mind. And if we come across anything specific in the code, we can discuss it in our meetings.

ashishsingh18 avatar Jan 14 '20 18:01 ashishsingh18