For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > July 2006 > in-process memory outstanding









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author in-process memory outstanding
kalx

2006-07-17, 7:00 pm

I'd like to track the allocated (newed) memory in my program.
I've tried using valgrind and looked at some others, leaktracer,
mtrace..
They all seem to track memory loss between the process starting
and exiting.

I want to track memory allocation during user events, while the
process is still running. My program exits cleanly, deallocating
everything.


I could overload new and delete, do some bookkeeping, say, using
"A Drop-in Debug Memory Manager" from Game Programming Gems 2.
I'm just dealing with a large code base, and I'd need to create a user
command to force writing out the log.
Not a huge deal, but I think a non-compiled in tool should be able to
do this.


thanks for any insight!
cheers

Mark

davids@webmaster.com

2006-07-17, 7:00 pm


kalx wrote:

> I could overload new and delete, do some bookkeeping, say, using
> "A Drop-in Debug Memory Manager" from Game Programming Gems 2.
> I'm just dealing with a large code base, and I'd need to create a user
> command to force writing out the log.
> Not a huge deal, but I think a non-compiled in tool should be able to
> do this.


There are many drop-in malloc replacements that can be arranged to work
at link time. Many of them have usage statistics. Looking at the growth
of the process' virtual address size may be sufficient, unless the
program 'mmap's large files or otherwise causes virtual address usage
to stop correlating with allocated memory. Valgrind has a tool called
'Massif' that may be exactly what you want.

DS

kalx

2006-07-18, 7:01 pm

> There are many drop-in malloc replacements that can be arranged to work
> at link time. Many of them have usage statistics. Looking at the growth
> of the process' virtual address size may be sufficient, unless the
> program 'mmap's large files or otherwise causes virtual address usage
> to stop correlating with allocated memory. Valgrind has a tool called
> 'Massif' that may be exactly what you want.



Hey, thanks for pointing me to Massif!
I tried it out, and as advertised, it gives usage statistics.

I would prefer to be able to pick a time to query the allocated
objects in detail, and compare with another time..
while the process is running.

Can you recommend something that will keep track of
allocations and give me access to dump to a log?

I want to know specifically which objects are allocated
between some user events.


thanks again!

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com