John B. Matthews
8/16/2008 11:57:00 AM
On 16 Aug 2008 at 11:50, jrdacc.i@gmail.com wrote:
> i want to get the amount of memory that my program takes in the start,
> and as long as the program is running,when this amount get changed the
> program update the output value that represent the ammount of memory
> and echo it
If you're interested in the amount of memory that's been dynamically
allocated so far, then your C implementation can probably tell you. For
example, with gcc you can #include <malloc.h> and use mallinfo().
For the total memory usage of your process, you may be able to find that
out from the kernel: for example, on Linux you could investigate
/proc/<pid>/status. How useful the information you'll get is is another
question though...