[Insight-users] how to free up the memory

Quan Chen quanchen at gmail.com
Tue Feb 1 13:39:18 EST 2005


Thanks for your info.  I actually found the SetReleaseDataFlag()
method by searching through the achieves.  I end up using the second
method that email suggested, create two seperate programs and save the
result of the first program output as input to the second program.

For UpdateLargestPossibleRegion(), do I need to call it for each
filters or it will like Update() method, automatically invoke the same
method for the filter before it?  It only do a memory
release/re-allocate or it also execute the filter so I don't need to
call Update() again?

BTW, I felt that some information, like the SetReleaseDataFlag and the
UpdateLargestPossibleRegion, should be put into the software guide. 
Maybe in Chapter 3, system overview.

On Fri, 28 Jan 2005 15:35:40 +1100, Gavin Baker <gavinb at cs.mu.oz.au> wrote:
> 
> Hello Quan,
> 
> On Wed, Jan 26, 2005 at 03:00:13PM -0600, Quan Chen wrote:
> > Hi, I am doing some CT segmentation and run into in-sufficient memory
> > problem.  I did a lot of pre-processing and use a lot of filters.  Those
> > filters connected to form a pipeline.  However, since my CT image is pretty
> > big, it quickly depleted my 2G memory and prevent me from proceed with my
> > pipeline.  I am wondering can I delete the memory allocated by the filter I
> > used in the previous steps?  I already invoked Update() function in the
> > middle of the pipeline and got the intermediate result, so it shouldn't
> > affect the running of the rest of the pipeline.
> 
> You can use the SetReleaseDataFlag on the readers, or upstream filters
> you know you won't need again.  This should free up a fair amount of
> memory; obviously it all depends on the pipeline.
> 
> You can call:
> 
>  image->GetBufferedRegion().GetNumberOfPixels()
> 
> to see how much memory is being retained at stages of the pipeine.
> 
> > Another problem that I encountered before, which might also relate to this
> > memory allocate/free problem.   BTW, I normally modify the sample
> > applications with GUI, such as GeodesicActiveContour.  I find that everytime
> > when I load a new image (which have dimension different from the previously
> > loaded image), the load itself is ok but when I update the subsequent filter
> > to perform processing, the program will exit abnormally.  I am wondering if
> > it is because some filters will allocate the necessary memory when it first
> > execute but don't check if the input image dimension has changed.
> 
> After the first Update() call, a filter will cache the requested
> region.  So when you load a new file, you need to force the filters to
> update themselves with the new region info (which may be different) by
> calling UpdateLargestPossibleRegion().
> 
> Regards,
> 
>  :: Gavin
> 
> --
> Gavin Baker                                      Complex Systems Group
> http://www.cs.mu.oz.au/~gavinb             The University of Melbourne
>


More information about the Insight-users mailing list