comp.unix.questions 
Author Message
 comp.unix.questions

Can anyone tell me a way to find out hwo much memory a C program is
using at a certain point. I tried with dbx and ps. It seems ps only
gives the maximum size of memory ever used. Am I right?

-------
Dahe Chen





Mon, 17 Aug 1992 06:18:00 GMT  
 comp.unix.questions
I think TOP may give an accurate account of how much
memory a program is using at a given time...although it has
the {*filter*} side effect of hogging system memory itself.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


Mon, 17 Aug 1992 13:13:00 GMT  
 comp.unix.questions

Quote:

>Can anyone tell me a way to find out hwo much memory a C program is
>using at a certain point. I tried with dbx and ps. It seems ps only
>gives the maximum size of memory ever used. Am I right?

This is apparently a UNIX-specific question and really has little to
do with C.  On UNIX, a process typically has a fixed amount of "text"
(instruction) space, a variable (fixed on some architectures) amount
of stack space for activation records, a fixed amount of preinitialized
data space, and a variable amount of "heap" (dynamic) memory space.
The latter is where memory assigned by the C library malloc() routine
comes from.  When a process needs more dynamic memory, it requests that
its heap space be grown by the operating system, via a sbrk() or brk()
system call.  (malloc() does that when necessary.)  There is really no
notion of how much of the current heap space is "used" or "unused"; it
is all available to your process.  That's what is reported by "ps" etc.


Mon, 17 Aug 1992 15:58:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. comp.arch comp.unix.questions comp.unix.programmer

2. comp.unix.questions comp.misc

3. Unix specific questions in comp.lan

4. CALL FOR DISCUSSION: comp.lang.c.dos and comp.lang.c.unix

5. How to access "comp.sources.unix"

6. Pascal to C translator appearing in comp.sources.unix

7. C Prototype generator posted to comp.sources.unix

8. new cdecl for ANSI C and C++ sent to comp.sources.unix

9. new cdecl to be posted to comp.sources.unix

10. alt.comp.databases,comp.databases,comp.databases.ms-sqlserver

11. Solaris Unix Porting Question / Signals Question

12. c/c++ book, comp.lang.c++, comp.lang.c++.leda, comp.lang.c++.moderated, comp.lang.c.moderated, comp.sys.mac.programmer.codewarrior

 

 
Powered by phpBB® Forum Software