[j-nsp] Routing Instance BGP Full Routing High Memory persists
Benny Amorsen
benny+usenet at amorsen.dk
Sun Dec 2 16:44:28 EST 2012
Michael Loftis <mloftis at wgops.com> writes:
> This is actually expected behavior of Unix-like OSes in general. RPD may
> in fact have released the memory (using free()) but will still have that
> RAM associated with it. This is due to the fact that Unix (BSDlike esp)
> generally use brk() or sbrk() under the hood during malloc() to request
> more RAM from the OS. There's actually no way for a process to return
> memory to the OS.
I believe you are a few years out of date with that information. Modern
malloc() implementations tend to use mmap() to get their memory, and
free() tends to unmap memory if the malloc library does not expect to
need the memory again soon. There is often a delay before the unmap.
However, it is easy to end up with fragmented memory which cannot be
returned to the OS. As long as there is even a single byte in use on a
page, that page has to be kept around. The various malloc libraries vary
in how good they are at avoiding fragmentation, but none of them are
perfect.
Most often it doesn't matter anyway; if a single almost-never-used byte
keeps a page from being freed, it can just go to swap. Similarly, if an
empty page is kept around just-in-case and the system needs the space,
it can just go to swap.
Routers, however, rarely have swap...
/Benny
More information about the juniper-nsp
mailing list