Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Feb 2002 08:12:40 -0600
From:      "Mike Meyer" <mwm-dated-1015251160.35ba68@mired.org>
To:        Lord Raiden <raiden23@netzero.net>
Cc:        questions@freebsd.org
Subject:   Re: Flush Memory
Message-ID:  <15484.59736.211315.154965@guru.mired.org>
In-Reply-To: <52480003@toto.iv>

next in thread | previous in thread | raw e-mail | index | archive | help
Lord Raiden <raiden23@netzero.net> 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.

	<mike
--
Mike Meyer <mwm@mired.org>			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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15484.59736.211315.154965>