Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Mar 2007 13:56:14 -0700
From:      Chuck Swiger <cswiger@mac.com>
To:        "Don O'Neil" <lists@lizardhill.com>
Cc:        'FreeBSD Questions' <freebsd-questions@freebsd.org>
Subject:   Re: Tracking down memory leaks
Message-ID:  <82EE8B68-A318-4E8E-A514-23177F280BBD@mac.com>
In-Reply-To: <000101c76bf5$e8b39030$0700020a@mickey>
References:  <000101c76bf5$e8b39030$0700020a@mickey>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Mar 21, 2007, at 1:17 PM, Don O'Neil wrote:
> My setup seems to have a memory leak of some kind and I'm not sure  
> how to
> track it down....
>
> When I first start up the system and all the processes start the  
> machine has
> 1GB in free memory... After running for 20-30 minutes the free  
> memory drops
> to somewhere around 20MB... The longer it runs, the more it chews  
> up free
> memory until it eventually kernel panics and then reboots and the  
> process
> starts all over again.
>
> I originally thought the reboot was from bad RAM, so I swapped it  
> out, but
> that didn't help. I ran a memory check and everything checks out ok.
>
> Any ideas where to look (Hardware? Bad CPU? Software?). Temperature  
> is ok,
> lots of fans in the box and round cables so there is good air flow.  
> I'm
> stumpted.

It's normal for the amount of "free" memory reported by top to  
decrease to a small percentage of available physical RAM, as the  
system uses that memory to cache as much stuff from disk as  
possible.  This does not necessarily mean that user processes are  
leaking memory-- to determine that, you'd need to look for processes  
which have their VSIZE grow without bounds over time (a period of  
hours or days is normally required, not minutes, although especially  
poorly written code might prove to be an exception).  There are  
memory leak checkers in the ports which can help diagnose this  
situation such as valgrind, although I seriously wish for the system  
malloc to come with something like the "leaks" utility found in MacOS X.

It's not normal for the system to panic; this often indicates a  
hardware problem.  But if you've done some hardware diagnostics & RAM  
tests, it might be a legitimate problem elsewhere.  There are some  
brief suggestions in "man crash" and a chapter in the Handbook on how  
to diagnose and debug system panics.

-- 
-Chuck




Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?82EE8B68-A318-4E8E-A514-23177F280BBD>