memory usage displsy

Per olof Ljungmark peo at intersonic.se
Wed Sep 2 15:13:56 UTC 2009


Mel Flynn wrote:
> On Tuesday 01 September 2009 23:19:23 Michael David Crawford wrote:
>> Per olof Ljungmark wrote:
>>> Well, my problem is that if I add up all I *can* see in top or ps it
>>> never gets near the by now 3G plus memory shown as "Active". Maybe one
>>> gig is accounted for,
>> I'm not that familiar with FreeBSD yet, but the kernel uses memory which
>> might not be charged against any process.
>>
>> For example, to map some virtual memory requires memory to store the
>> mappings in.
>>
>> Open files have kernel structures, as do filesystems.
>>
>> If top or ps were only to show userspace memory allocations, then you're
>> right, a lot of memory would be unaccounted for.
> 
> It doesn't for the Active to Free states. For individual processes, everything 
> is shown that the process allocates. So for a file descriptor, an int would be 
> allocated, where the kernel holds the real info.
> 
> This is one cause for filled Active memory: a process polling multiple file 
> descriptors, like a File Alteration Monitor under current desktops.
> 
> The other, as Dan Nelson described, is file cache. If you want to be sure it's 
> this, then reboot the machine and run:
> /etc/periodic/security/100.chksetuid
> 
> You should see memory usage going up. If this causes a performance problem 
> (i.e. You sometimes are subject to heavily increasing loads on a mailserver, 
> that causes a lot of forks and file cache memory isn't unloaded fast enough), 
> then you should either disable the security check or properly seperate data 
> from binaries using partitions and mount data partitions with nosuid/noexec, 
> so that these are omitted from the daily checks.

Thank you all for the informative answers, helped a lot to understand 
better what is going on.

I cannot run 100.chksetuid on a production server but I will definitely 
do it on the testing one.

Cheers,
--
per


More information about the freebsd-questions mailing list