[ITK] [ITK-users] R-SimpleITK memory management

Mathew Guilfoyle mrguilfoyle at gmail.com
Wed Jul 6 09:55:45 EDT 2016


I'm processing a large number of CT scans using R wrapped SimpleITK
(some filtering and then registration before a segmentation).   I'm
running R within RStudio on OS X 10.11

I'm running into memory problems with long processing runs.  Though in
the R loops I reassign new images to the same R variable the
underlying C++ objects do not seem to get deleted but accumulate on
each loop - I can see steadily rising memory usage in Activity Monitor
until R/RStudio crashes.  I have tried explicitly deleting the
temporary images during each loop and calling the R garbage collector
(gc()), but it doesn't seem to have an effect.  If I restart the R
session then the memory is cleared.

My understanding was that the C++ objects would get garbage collected
once all pointers are removed but this doesn't seem to happen.  Is
there a method to explicitly delete the C++ image objects so I can
manage the memory usage myself?

Cheers
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list