Producing memory traces of C storage allocation?

ratatat@army.net (Corndog)
28 Jun 2001 23:45:11 -0400

          From comp.compilers

Related articles
Producing memory traces of C storage allocation? ratatat@army.net (2001-06-28)
Re: Producing memory traces of C storage allocation? joachim_d@gmx.de (Joachim Durchholz) (2001-07-02)
Re: Producing memory traces of C storage allocation? graeme@epc.co.uk (Graeme Roy) (2001-07-02)
Re: Producing memory traces of C storage allocation? gneuner@dyn.com (2001-07-02)
Re: Producing memory traces of C storage allocation? frido@q-software-solutions.com (Friedrich Dominicus) (2001-07-17)
| List of all articles for this month |

From: ratatat@army.net (Corndog)
Newsgroups: comp.compilers
Date: 28 Jun 2001 23:45:11 -0400
Organization: http://groups.google.com/
Keywords: C, storage, question, comment
Posted-Date: 28 Jun 2001 23:45:11 EDT

Hmm..this is quite the question Im sure, but does anyone know of a C
compiler or is anyone able to tell me how to create one (roars of
laughter) that is able to force the program being generated to log all
calls to memory allocation routines like malloc and free in order for
me to be able to determine the size of the heap at any point during
the program execution? Or is there another simpler more intelligent
way of doing it? Just writing wrappers for them doesnt work (I think)
cos I wont intercept such calls by library routines. I also know I can
just write a separate program that will monitor the heap size of a
target program, only doing it this way I cannot make any guarantees
about the shape of the resulting graph cos I cant control the way the
OS decides to interleave the execution of the two! Right? Does anyone
see what I'm getting at? I figure the only way I can get the actual
size of the heap at any given point in time is to have the compiler
intercept the memory allocation routines and do the work of wrappers
for me. Please help..puhlease! I'm working on Windows by the way.


(I have never done any work on compilers before and I have limited
knowledge of C, but I can touch my nose with my tongue! Duh..huh huh)


Thanks


Corny :)
[Hmmn, Windows. Depending on how the libraries are structured, you
might be able to wrap or replace malloc and free, but the easiest
thing to do is to look at the heap size at the end since free doesn't
give memory back, it marks it as reusable by the program. -John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.