Strange networking behaviour (memory leak?)

Bill Moran wmoran at
Tue Apr 22 05:32:35 PDT 2003

Adam wrote:
> I've recently become very concious of possible memory leaks on my
> FreeBSD box. While troubleshooting a particular memory leak, I came
> across some very peculiar behaviour when copying files over the local
> 100mbit network.
> When copying files over the network, the free memory on my FreeBSD box
> drops at a rate of about 30mb every couple seconds. It eventually
> bottoms out at about 500k free. 
> If I kill the active transfer, the amount of free RAM is not affected.
> However, if I delete the file that was being written to the FreeBSD box,
> the free RAM instantaneously increases by about 400-450mb. Note that
> this has only been tested on transfers of large files (>600mb).
> I've tested this behaviour both by downloading from my Windows computer
> to the FreeBSD box (using lftp on FreeBSD), and by uploading from the
> Windows computer to the FreeBSD machine via PureFTPd (SFTP behaves
> similarly, but much slower since I get max 165k/s via SFTP).
> Is this behaviour expected? Is it normal? 

Yes and yes.
I assume that you're looking at the output of top while you're doing this.
FreeBSD is pretty smart about memory.  In the top display you see active,
inactive, cache, buffer, wired, and free memory.  The memory that's actually
free is really the sum of inactive, buffer, cache, and free.  The free
memory is free immediately, those other three can become free with very,
very little effort on the part of the kernel, but if you call up the same
application again and it's still in inactive memory, it'll start up quicker
than if it has to reload it from disk.
Free memory is wasted memory.

Bill Moran
Potential Technologies

More information about the freebsd-questions mailing list