From owner-freebsd-questions Wed Feb 27 6:12:49 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mired.org (dsl-64-192-6-133.telocity.com [64.192.6.133]) by hub.freebsd.org (Postfix) with SMTP id 2976A37B402 for ; Wed, 27 Feb 2002 06:12:45 -0800 (PST) Received: (qmail 59451 invoked by uid 100); 27 Feb 2002 14:12:40 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15484.59736.211315.154965@guru.mired.org> Date: Wed, 27 Feb 2002 08:12:40 -0600 To: Lord Raiden Cc: questions@freebsd.org Subject: Re: Flush Memory In-Reply-To: <52480003@toto.iv> X-Mailer: VM 6.90 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ From: "Mike Meyer" X-Delivery-Agent: TMDA/0.46 (Python 2.2; freebsd-4.5-STABLE-i386) Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Lord Raiden types: > Hi all. Ok, I've got one server that's got a problem. I'm not sure which > is the offending program, but until I get time to find it I kind of want to > Band-Aid it for now. What's happening is I've got processes that are using > memory but not releasing it after they close, then the memory fills up and > dumps into the swap file, that overloads and the server dies. If by close you mean the process dies, then this can only happen with shared memory. If the last person using a shared memory segment fails to free it, it'll just stay in memory. You can use ipcs to find them, and ipcrm to clean them up. Scripting those two to do the job shouldn't be a problem. But that should be the hint you need. > I'm looking for something that will go in and flush the physical memory > every hour and clear out any memory that isn't locked by a given > process. Basically memory that can be freed up and isn't needed > anymore. I know they have a program called "freemem" that does something > similar to this on windoze, but I'm just needing to totally clean out the > dead, abandoned, orphaned, or unused physical memory without dumping it to > the swap file to maximize available memory. Any ideas? Thanks. Yeah - doing that would seriously degrade the performance of your system. When memory is freed, FreeBSD marks it as "available" and remembers what it was from. If something then needs same thing - the first page of an executable, say - then the system grabs the copy that's in the available pool, marks it as used, and gives it to them instead of doing disk I/O to get it. http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message