From owner-freebsd-questions@FreeBSD.ORG Wed Mar 21 20:56:16 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4626D16A409 for ; Wed, 21 Mar 2007 20:56:16 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from mail-out3.apple.com (mail-out3.apple.com [17.254.13.22]) by mx1.freebsd.org (Postfix) with ESMTP id 2D43113C45B for ; Wed, 21 Mar 2007 20:56:15 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from relay5.apple.com (relay5.apple.com [17.128.113.35]) by mail-out3.apple.com (8.13.8/8.13.8) with ESMTP id l2LKuFuM009490; Wed, 21 Mar 2007 13:56:15 -0700 (PDT) Received: from relay5.apple.com (unknown [127.0.0.1]) by relay5.apple.com (Symantec Mail Security) with ESMTP id A994329C002; Wed, 21 Mar 2007 13:56:15 -0700 (PDT) X-AuditID: 11807123-b062fbb000005a91-0f-46019bef67bf Received: from [17.214.13.96] (cswiger1.apple.com [17.214.13.96]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by relay5.apple.com (Apple SCV relay) with ESMTP id 99AB030400D; Wed, 21 Mar 2007 13:56:15 -0700 (PDT) In-Reply-To: <000101c76bf5$e8b39030$0700020a@mickey> References: <000101c76bf5$e8b39030$0700020a@mickey> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <82EE8B68-A318-4E8E-A514-23177F280BBD@mac.com> Content-Transfer-Encoding: 7bit From: Chuck Swiger Date: Wed, 21 Mar 2007 13:56:14 -0700 To: "Don O'Neil" X-Mailer: Apple Mail (2.752.2) X-Brightmail-Tracker: AAAAAA== Cc: 'FreeBSD Questions' Subject: Re: Tracking down memory leaks X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2007 20:56:16 -0000 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