[vtkusers] Problem with array not being deleted

Normand Mongeau nmongeau at videotron.ca
Thu Oct 11 14:01:45 EDT 2007


Hi,

I have a problem in C++, that goes like this:

vtkImageData *workingImage = vtkImageData::New();
workingImage->SetNumberOfScalarComponents( 1 ); 
entireData = (unsigned char*)malloc(someSize);
workingImage->SetScalarTypeToUnsignedChar(); 
vtkUnsignedCharArray *charArray = vtkUnsignedCharArray::New( ); 
charArray->SetNumberOfComponents( 1 ); 
charArray->SetArray( entireData, someSize, 0 ); // 0 means to delete after use
workingImage->GetPointData()->SetScalars( charArray ); 
workingImage->Delete();
The problem is that my malloc'ed array never gets deleted.  In fact, the vtkUnsignedCharArray itself never gets deleted.

Is there a fix/workaround to this?

Thanks,

Normand
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20071011/4f97bdd4/attachment.htm>


More information about the vtkusers mailing list