[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: VSZ memory of X

On Sun, Oct 22, 2000 at 07:59:09PM +0200, Christian Hammers wrote:
> Hi
> My X uses 80M of VSZ but only 8M of RSS memory. The eight megabytes seams
> reasonably for an X server but why is the VSZ part so high? Does every
> program that runs under X request it from X and so raises X's memory 
> statistic?

Requested size is just the size of the memory footprint as it appears in
the page table.  My X server always reports about 160MB 'usage', likely
because of the way AGP is implemented in the kernel; similarly, my 3D
engine reports 160MB usage (for probably the same reason) when its RSS is
only 32 (and even that's when my LOD cache has become oversaturated, but
that's another matter).

Basically, the VSZ is just the *potential* usage, whereas the RSS is
*actual* usage.  Pay no mind to VSZ for anything which does funky memory
mapper tricks.

As a simple test of this, do a malloc() on some egregriously large amount
of memory (say, 64MB), but don't actually use it, and look as the VSZ vs.
RSS of the program.  Linux uses an allocate-on-demand policy for large
allocations (technically, it mmap()s /dev/zero, and mmap is a nice generic
interface to the pagetable), so even though it has 64MB of *potential*
memory usage, only the memory which has actually been touched is actually
allocated.  It's a similar issue with the X server et al.

Joshua Shagam                  /"\ ASCII Ribbon Campaign
joshagam@cs.nmsu.edu           \ / No HTML/RTF in email
www.cs.nmsu.edu/~joshagam       X  No Word docs in email
mp3.com/fluffyporcupine        / \ Respect for open standards

Reply to: