mallinfo equivalent on FreeBSD

Daniel O'Connor doconnor at gsoft.com.au
Mon Jul 12 04:42:41 UTC 2010


On 12/07/2010, at 12:40, dhruva wrote:
> On Wed, Jun 30, 2010 at 12:49 PM, dhruva <dhruvakm at gmail.com> 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.
>> 
>> 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.
> 
> 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








More information about the freebsd-hackers mailing list