From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 12 04:42:41 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D33C91065675 for ; Mon, 12 Jul 2010 04:42:41 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.freebsd.org (Postfix) with ESMTP id 59CC38FC1B for ; Mon, 12 Jul 2010 04:42:40 +0000 (UTC) Received: from ur.gsoft.com.au (Ur.gsoft.com.au [203.31.81.44]) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id o6C4gW1u003878 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Mon, 12 Jul 2010 14:12:38 +0930 (CST) (envelope-from doconnor@gsoft.com.au) Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: "Daniel O'Connor" In-Reply-To: Date: Mon, 12 Jul 2010 14:12:32 +0930 Content-Transfer-Encoding: quoted-printable Message-Id: <44ECC517-F96D-4DA3-845E-61E2B5793BCC@gsoft.com.au> References: To: dhruva X-Mailer: Apple Mail (2.1081) X-Spam-Score: -2.51 () ALL_TRUSTED,BAYES_00,T_RP_MATCHES_RCVD X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 Cc: FreeBSD Hackers Subject: Re: mallinfo equivalent on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2010 04:42:41 -0000 On 12/07/2010, at 12:40, dhruva wrote: > On Wed, Jun 30, 2010 at 12:49 PM, dhruva wrote: >> Hello, >> I would like to know the memory usage (total virtual memory) inside = a >> process and make decisions accordingly. >> To be more specific, I am using BerkeleyDB backed set or std::set = (C++ >> STL) depending on my current memory usage >> as my process will need to run in a resource constrained environment. >> By the way, this is user mode application. >>=20 >> Some things I am considering/tried: >> 1. GNU/Linux has mallinfo and I had my code working based on the >> information I get from the call. >=20 > Could anyone please help and throw some light on this topic (mallinfo) > equivalent. I am stuck and need > resolve this soon. In short, I need to find out the virtual memory > used (mapped to the process's address space) > in a light weight fashion so that I can make some decision based on = it. Can't you use getrusage to find that out? As for system wide stats, I think you could look at sysctl, specifically = the vm tree. -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C