# Memory usage of user space process with C++ program



## vinod.divya15 (May 29, 2019)

Hello There,

I want to write a C++ program which can find consolidated real memory used by top 100 memory extensive user space processes (some thing similar to what top command does). However, I don't  want to execute top command through C++ program.

Is there any system call or library that I can you to achieve this ?

Many thanks,

- Vinod


----------



## SirDice (May 29, 2019)

You know FreeBSD is open source right? So, why don't you take a look at the source code to see how top(1) does it?






						[base] Contents of /head/usr.bin/top/top.c
					






					svnweb.freebsd.org


----------

