[vtkusers] tkImageData - vtkUnsignedCharArray: Unable to allocate 768951260 elements of size 1 bytes.
vacingforo
vacingforo at gmail.com
Tue Jul 17 09:32:50 EDT 2018
Hello,
I have the following code piece :
vtkSmartPointer<vtkImageData> image =
vtkSmartPointer<vtkImageData>::New();
image->SetSpacing(spacing);
image->SetDimensions(dim);
image->SetExtent(-1, dim[0] + 1, -1 , dim[1] + 1, 0, dim[2] - 1);
image->SetOrigin(origin);
image->AllocateScalars(VTK_UNSIGNED_CHAR, 1);
vtkIdType count = image->GetNumberOfPoints();
for (vtkIdType i = 0; i < count; ++i)
{
image->GetPointData()->GetScalars()->SetTuple1(i, white);
}
I get the following error when i process a polydata from vtp file of only
10K(It does not happen with smaller polydata).
ERROR: In C:\VTK-7.1.1\Common\Core\vtkGenericDataArray.txx, line 394
vtkUnsignedCharArray (0xcc2ac80): Unable to allocate 768951260 elements of
size 1 bytes.
what(): std::bad_alloc
It was compiled in mingw 32 bits in Windows 10.
for more details check small application and a Windbg results in the
following link:
https://drive.google.com/drive/folders/13ZesoMHHvhAfe6zz__RIZ2qWDfmOcu0b?usp=sharing
The memory seems to be ok but I don't know why it does not work.
Best regards,
Sergio
--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
More information about the vtkusers
mailing list