I've been fighting with a nasty memory problem for a few weeks
now. I have a large dataset (512x128x128) of vector data that I'm
trying (for no other reason that to say I tried it) to render flow
glyphs, one at every vertex. Of course, my system doesn't have
enough memory for the required geometry of a sphere at every datapoint.<br>
<br>
I had expected VTK to simply print an error, generate a garbage image,
and go about it's business. What actually happens is a
coredump. I've discovered that in
Common/vtkDataArrayTemplate.txx, all of the arrays are allocated
through "new", and subsequently checked to make sure they aren't
NULL. While this works for "mallocs", most alot of C++
implementations (including the MipsPro version on these SGI's) raise a
"bad_alloc" exception instead. I made the required changes (patch
attached to see the changes) to do the same thing as the null checks
through Try/Catch blocks but I'm saddened to see that it still doesn't
work.<br>
<br>
Alot of the functions, like Allocate, return 1 on success and 0 on
failure. Unfortunately, I can't see these return values ever
being used. Also, alot of these functions make invalid
assumptions about things working, most notably
vtkDataArrayTemplate::WritePointer. This function returns
(this->Array + id), whether this->Array is NULL or valid.
This causes later segfaults if any of the Resize or Allocate functions
failed to allocate the memory.<br>
<br>
I've done a little work on trying to add the necessary safeties to make
these conditions "fail gracefully", but it's in alot of classes.
Unfortunatley, I'm not really well versed in VTK design yet, so I
thought I would present this to the group. Is anyone at Kitware
aware/working on this?<br>-- <br>Randall Hand<br><a href="http://www.yeraze.com">http://www.yeraze.com</a>