[vtkusers] Memory issues !
tutu lamotte
tutulamotte at yahoo.com
Wed Sep 17 15:53:36 EDT 2003
Dear list!
We are currently tracking the memory usage of our application made on top of VTK.
We discovered that using VTK instead of OpenGL directly means that our application takes way too much memory for its 3D display needs.
We just find out that a lot of memory seams to be wasted like in this case when calling Render on a vtkLODActor instance.
CALL STACK :
==> extern:"_nh_malloc()" at line 194 (dbgheap.c) in "msvcrtd.dll"
==> extern:"::operatornew(unsigned int)" at line 24 (new.cpp) in "msvcrtd.dll"
==> extern:"vtkIdTypeArray::ResizeAndExtend(int)" at line 214 (D:\Program Files\vtk40\vtk-src-windows\Common\vtkIdTypeArray.cxx) in "vtkcommon.dll"
==> extern:"vtkIdTypeArray::Squeeze(void)" at line 82 (D:\Program Files\vtk40\vtk-src-windows\Common\vtkIdTypeArray.h) in "vtkcommon.dll"
==> extern:"vtkCellArray::Squeeze(void)" at line 228 (D:\Program Files\vtk40\vtk-src-windows\Common\vtkCellArray.h) in "vtkcommon.dll"
==> extern:"vtkPolyData::Squeeze(void)" at line 1349 (D:\Program Files\vtk40\vtk-src-windows\Common\vtkPolyData.cxx) in "vtkcommon.dll"
==> extern:"vtkAppendPolyData::Execute(void)" at line 514 (D:\Program Files\vtk40\vtk-src-windows\Graphics\vtkAppendPolyData.cxx) in "vtkgraphics.dll"
==> extern:"vtkSource::ExecuteData(class vtkDataObject*)" at line 163 (D:\Program Files\vtk40\vtk-src-windows\Common\vtkSource.h) in "vtkcommon.dll"
==> extern:"vtkSource::UpdateData(class vtkDataObject*)" at line 418 (D:\Program Files\vtk40\vtk-src-windows\Common\vtkSource.cxx) in "vtkcommon.dll"
==> extern:"vtkDataObject::UpdateData(void)" at line 411 (D:\Program Files\vtk40\vtk-src-windows\Common\vtkDataObject.cxx) in "vtkcommon.dll"
==> extern:"vtkDataObject::Update(void)" at line 292 (D:\Program Files\vtk40\vtk-src-windows\Common\vtkDataObject.cxx) in "vtkcommon.dll"
==> extern:"vtkOpenGLPolyDataMapper::RenderPiece(class vtkRenderer*,class vtkActor*)" at line 154 (D:\Program Files\vtk40\vtk-src-windows\Rendering\vtkOpenGLPolyDataMapper.cxx) in "vtkrendering.dll"
==> extern:"vtkPolyDataMapper::Render(class vtkRenderer*,class vtkActor*)" at line 83 (D:\Program Files\vtk40\vtk-src-windows\Rendering\vtkPolyDataMapper.cxx) in "vtkrendering.dll"
==> extern:"vtkOpenGLActor::Render(class vtkRenderer*,class vtkMapper*)" at line 128 (D:\Program Files\vtk40\vtk-src-windows\Rendering\vtkOpenGLActor.cxx) in "vtkrendering.dll"
==> extern:"vtkLODActor::Render(class vtkRenderer*,class vtkMapper*)" at line 205 (D:\Program Files\vtk40\vtk-src-windows\Rendering\vtkLODActor.cxx) in "vtkrendering.dll"
If the geometry is a simple low resolution Cylinder, this Render can generate an allocation of up to 15K !!!
The way this vtkIdTypeArray::ResizeAndExtend function works seams to be on a recursive pattern where the memory allocation size is not determined based on the need but by the double of the previously allocated size.
For instance, on the first call, the size is 1. If this isnt enough (Which is always the case of course) ResizeAndExtend is recalled with size 1 but will generate an allocation of 1 + what is already allocated. This becomes 2. And so on in a square progression.
THE QUESTION:
Is there a way we can reclaim the unused memory allocated through this mechanism?
---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030917/bf4150c3/attachment.htm>
More information about the vtkusers
mailing list