[vtkusers] Virtual Memory Goes Up Dramatically

Janny Dong janny.dong at gmail.com
Fri Aug 24 15:38:20 EDT 2007


Hi all,

I developed a visualization project with VTK and MS Visual Studio.NET 2003.
The pipeline is:
vtkPoints,
vtkDoubleArray-->vtkPolyData-->vtkDelaunay2D-->vtkPolyDataMapper-->vtkRenderer-->vtkRenderWindow-->vtkWindowToImageFilter-->vtkAVIWriter

I defined a function vtkWindowToImageFilter *ImgRender() to render each
frame. The function is called in a loop to write the image frames to a movie
file. The code runs with no error except the virtual memory goes up
dramatically. My machine has Windows XP, 1GB RAM. I opened Windows Task
Manager while my code was running, the commit charge increased fast, about
3MB per frame. Although the memory usage of my program decreased ( it first
went up to 700MB but then decreased to around 60MB), the commit charge just
went up until the program stopped with throwing a std::bad_alloc exception.
If Windows only allows one process to consume up to 1.6GB memory, my program
just stops there. I don't know what is happening here.

I carefully checked the pairs of New() and Delete(). I am also using
vtkSmartPointer. Moreover, I enabled GlobalImmediateModeRenderingOn and
ReleaseDataFlagOn. But still, the memory management of my code appears to be
a mess.  Is it possible memory is not freed even when Delete() is called?
Maybe a dumb question, but what is a good way to check memory leak? Could
anyone share some experience?

Thanks a lot,
Janny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070824/347cdc91/attachment.htm>


More information about the vtkusers mailing list