Re: Producing memory traces of C storage allocation?

gneuner@dyn.com (George Neuner)
2 Jul 2001 00:32:53 -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: gneuner@dyn.com (George Neuner)
Newsgroups: comp.compilers
Date: 2 Jul 2001 00:32:53 -0400
Organization: Automated Visual Inspection Systems, Inc.
References: 01-06-065
Keywords: C, storage
Posted-Date: 02 Jul 2001 00:32:53 EDT

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


>Does anyone see what I'm getting at?


Not exactly.


>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.


Do you really need to intercept allocation calls interactively or can
you make do with periodic heap dumps?


You didn't say what compiler you are using. On Win32, both VC++ and
Borland vector (m|c)alloc and new through HeapAlloc on the global
process heap.


I'm not aware of a way to front hook the allocator (you can hook the
back end exception handler but that won't help you here). However, if
a dump of the heap will suffice, you can obtain it using the HeapWalk
function in the Win32 API or _heapwalk in the C runtime library. In
general you should become familiar with the Heap* functions for
serious programming in Win32.




If you are using a Win32 version of GCC, you're on your own because I
know nothing about the runtime support for them. I would suggest you
get the source to the standard library, modify the allocator as you
need and build a custom library to use.




>(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)


I hope you can swim because the water is blue and there be sharks ;)




George


Post a followup to this message

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