[vtkusers] [Paraview] vtkEllipsoidSource class

David Doria daviddoria+vtk at gmail.com
Thu Oct 15 16:16:10 EDT 2009


>    David,
>>>
>>>    I see a lot of calls to X::New() but no calls to X->Delete().
>>>    You've got to be more careful about memory leaks. Some of the
>>>    examples you posted on the wiki also have leaks. There is a flag
>>>    VTK_DEBUG_LEAKS set it to on and you will get a message about any
>>>    leaks you create.
>>>
>>>    By the way, in addition before I show my code to anyone I want to
>>>    run valgrind --leak-check=full --show-reachable=yes to verify that
>>>    I haven't overlooked anything. Often this catches serious errors.
>>>
>>>    You may consider using shallow copy rather than deep copy when
>>>    possible it's faster and uses less memory.
>>>
>>>    You have tabs in the source, you should use 2 spaces to conform to
>>>    KW style (your editor should handle for you).
>>>
>>>    Hope this helps,
>>>    Burlen
>>>
>>>
As per Burlen's suggestions, I fixed all of the memory leaks and got rid of
the deep copies.  I also made vtkEllipsoidSource the superclass of
vtkSphereSource, as this makes much more sense, as a sphere IS AN ellipsoid
and hence the inheritance is sound.

The updated code is in the same location as before:
http://www.rpi.edu/~doriad/VTK_List/vtkEllipsoidSource/

I named the new sphere classes vtkSphereSource2 for clarity for the moment.

I tried to conform to the VTK style of indentation and brackets - but I know
I left some tabs in there still... is there an automated way to change these
tabs to the 2 space style? My editor (KDevelop) lets me set what happens to
FUTURE tab keypresses, but I didn't see anything that would go through and
change all existing tabs to the new setting. Suggestions?

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091015/1db79851/attachment.htm>


More information about the vtkusers mailing list