[vtkusers] how to release memory in vtkImageData

kdsfinger at gmail.com kdsfinger at gmail.com
Wed Oct 18 10:40:43 EDT 2006


hi, there

I've declared the vtkImageData * vtkimage as global object and
sometimes I want to reload different datasets into the vtkimage. I did
like this:

void reloadImage(){
vtkimage = reader->Update();
}

That works fine. But, are there memory leak by doing that? Each time I
do reload, the vtkimage points to the new dataset the the old one was
lost. If there is a memory leak, how can I correct it? I tried to add

void reloadImage(){
vtkimage->Initialize();
vtkimage = reader->Update();
}

but got segmentation error at runtime. Basically, I want to release
the memory of the vtkImageData of the old dataset before it takes a
new dataset. Thanks for comments.

zl2k



More information about the vtkusers mailing list