[Insight-users] Release memory

Silvano Agliozzo agliozzo at isiosf.isi.it
Thu, 18 Mar 2004 13:24:37 +0100 (CET)


Hi,

I'm using the WeightedKdTreeGenerator to implement a cluster method by a 
kdtree. 
This tree generator use a PointSetToListAdaptor as a sampletype.
I pass pointer to the sample and the kdtree to a member function, that 
generate tree and sample, something like:

...
...

TreeType::Pointer tree;
SampleType::Pointer sample;

Generate( tree, sample );

the data pointed by these pointers (tree and sample) are not anymore 
available in the following code. This is because the data is released out 
of the scope of the Generate member function. I wonder if there is a way 
to not release this memory, something like buffer mummifying the buffer 
explained in the Getting-Started-V.pdf document available in the itk 
web page. Otherwise, I have to write severals lines, all packed in a 
member function making the code reading hard.

thank in advance,

Silvano