What's the system call for collecting the memory information?

What's the system call for collecting the memory information?

Post by Jun Lian » Thu, 16 Jul 1998 04:00:00



Hi,
I am working on a program to test memory leakage
caused by dangling pointers in C and C++ programs.
Now, I just want to find out how much memory a
process may take. Is there any system call for
this purpose? I don't want to read the /proc/meminfo
file and parse that file manually, I just want to do
this in a somewhat clean different way.
Would any one please give me some advice on that?

Thanks a lot

Jun

 
 
 

What's the system call for collecting the memory information?

Post by Christopher Qual » Sat, 18 Jul 1998 04:00:00


The "top" command lists various attributes of processes
such as memory and cpu usage. There is a code analyzer
called lclint that will scan your C (I don't know about
C++) code and try to detect memory that has been allocated
but not restored (among other programming errors) and
there is a great memory program called Electric Fence that
is a great tool in debugging memory errors (you link against
it with -lefence when building your program and run the
program in a de* (gdb, xxgdb, ddd)). "top" should be
on your computer, whereas you may have to go out and find
lclint and Electric Fence.

Hope this helps,
Chris


> Hi,
> I am working on a program to test memory leakage
> caused by dangling pointers in C and C++ programs.
> Now, I just want to find out how much memory a
> process may take. Is there any system call for
> this purpose? I don't want to read the /proc/meminfo
> file and parse that file manually, I just want to do
> this in a somewhat clean different way.
> Would any one please give me some advice on that?

> Thanks a lot

> Jun

--
Christopher Quale
UC Berleley Group in Biostatistics

homepage: http://www.veryComputer.com/