Memory mangement

Ron Inbar rinbar at
Thu Sep 30 15:57:16 EDT 1999


I run VTK under Windows NT 4.0.  My machine is a Pentium II 400 with 384MB
of physical memory + 768MB of virtual memory (1GB in total).

I still don't quite understand how VTK allocates and deallocates memory.  I
built an imaging pipeline as follows:

vtkVolume16Reader -> vtkImageGaussianSmooth -> vtkExtractVOI ->

I specified SetMemoryLimit 50000 for the vtkVolume16Reader and for the
vtkImageGaussianSmooth, and no limit for the other filters.  I raised the
GlobalReleaseDataFlag.  Finally, I issued a Write command to the
vtkStructuredPointsWriter and watched the NT resource monitor as the
pipeline executed.

I expected the memory usage to be a little over 100,000kB when the
vtkImageGaussianSmooth is executing (50,000kB for the reader's output +
50,000kB for the smoother's output + perhaps a couple of MB for the rest of
the program).  Since my dataset is about 128MB in size, I expected the first
three filters to execute three times (2 < 128MB / 50,000kB < 3), and then
the writer to execute once.

What I saw instead was as follows: the memory usage reached over 300,000kB;
vtkVolume16Reader executed once; then vtkImageGaussianSmooth executed twice
in a row; then vtkExtractVOI executed once; and finally
vtkStructuredPointsWriter executed once.

This behavior completely puzzles me.  Specifically, I'm concerned with the
following points:

1. How could the memory usage get so high when the two largest data objects
are specifically limited to 50000kB each?  (The vtkExtractVOI subsamples the
data by a factor of 4 x 4 x 2 = 32, so its output is supposed to be
considerably smaller than the other two data objects.)

2. How could the memory limit cause the same filter to execute twice in a
row?  Where did this filter store its output?

3. How did it it manage to fill up the physical memory almost completely (I
was left with only about 4MB) and still didn't swap too much?  Is it
possible that VTK detects the amount of available physical memory and
ignores the specified memory limits?

I'm very curious to know the answers to these questions.

Thanks in advance,


This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.

More information about the vtkusers mailing list