Subject: Re: Virtual Memory Subsystem
To: None <port-i386@NetBSD.ORG>
From: Thor Lancelot Simon <tls@panix.com>
List: port-i386
Date: 11/26/1996 00:07:25
> This is the well-known "swap-leak" bug. What happens is that swap
> space allocated to a VM object is never deallocated until the VM
> object is destroyed. Thus, when part of a daemon is paged out, and
> paged back in again, the swap space allocated remains allocated to
> that daemon, even though that daemon doesn't need it after being paged=

> back in. Since daemons don't exit at all, the swap space is never
> reclaimed. (actually, the swap space can be reclaimed by going to
> single user mode - you should notice used swap space going back to 0
> after a "shutdown now").

Actually, there's another leak in there; shadow objects are never reclaimed,
ever.  Luckily, shadow objects aren't created very often unless you have many
programs, descendents of each other, modifying the same mmap()ed file, but you
may see a slow, steady leakage of VM due to this on, say, news servers.

I've never actually seen enough VM get consumed that way to crash a machine,
even over months of run time, but it's still kinda messy.

This is all modulo someone explaining the "shadow object leak" to me a long
time ago before I had even the slightest idea how the VM system worked, my
subsequently acquiring the slightest idea thereof, and a quick look at the
code just now.  If I've munged up some part of the explanation or someone more
qualified would like to explain it better I'd love to benefit from that.

Thor