From owner-freebsd-hackers Sat Jan 12 15:45:44 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.acns.ab.ca (h24-64-56-135.cg.shawcable.net [24.64.56.135]) by hub.freebsd.org (Postfix) with ESMTP id D554437B402 for ; Sat, 12 Jan 2002 15:45:27 -0800 (PST) Received: from colnta.acns.ab.ca (colnta.acns.ab.ca [192.168.1.2]) by mail.acns.ab.ca (8.11.6/8.11.3) with ESMTP id g0CNjRI69227; Sat, 12 Jan 2002 16:45:27 -0700 (MST) (envelope-from davidc@colnta.acns.ab.ca) Received: (from davidc@localhost) by colnta.acns.ab.ca (8.11.6/8.11.3) id g0CNjQS27490; Sat, 12 Jan 2002 16:45:26 -0700 (MST) (envelope-from davidc) Date: Sat, 12 Jan 2002 16:45:26 -0700 From: Chad David To: Nate Williams Cc: Kris Kennaway , hackers@FreeBSD.ORG Subject: Re: Amount of free memory available in system? Message-ID: <20020112164526.A27462@colnta.acns.ab.ca> Mail-Followup-To: Nate Williams , Kris Kennaway , hackers@FreeBSD.ORG References: <15424.32963.768829.892783@caddis.yogotech.com> <20020112142534.D40866@xor.obsecurity.org> <15424.50454.973048.932329@caddis.yogotech.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <15424.50454.973048.932329@caddis.yogotech.com>; from nate@yogotech.com on Sat, Jan 12, 2002 at 04:21:58PM -0700 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, Jan 12, 2002 at 04:21:58PM -0700, Nate Williams wrote: > > > Is there a simple sysctl or a command line utility I can use to > > > determine how much free memory is available in a system? > > > > > > I've got an embedded application that has *very* limited memory, and I > > > was trying to figure out how much memory was available for the userland > > > applications. > > > > > > 'top' has something, as well as 'vmstat'. Unfortunately, because of the > > > limited amount of disk space available on this box, I don't have access > > > to either one of those. > > > > > > Is there a sysctl I can use to determine how much free memory is > > > available on the box? > > > > Why not look how top and vmstat calculate it and do that in your code. > > I was hoping to get do 'sysctl foo.bar.bletch' to tell me information. vm.stats.vm.v_free_count will give you a somewhat useful number. As well there are sysctls for active, inactive, and cached (and wired), which you could use to get a more complete picture of whats going on. `sysctl vm` dumps a lot of useful information. I hope that helps. -- Chad David davidc@acns.ab.ca www.FreeBSD.org davidc@freebsd.org ACNS Inc. Calgary, Alberta Canada Fourthly, The constant breeders, beside the gain of eight shillings sterling per annum by the sale of their children, will be rid of the charge of maintaining them after the first year. - Johnathan Swift To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message