Xref: utzoo comp.lang.c:35359 comp.unix.programmer:876 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!mcnc!duke!drh From: drh@duke.cs.duke.edu (D. Richard Hipp) Newsgroups: comp.lang.c,comp.unix.programmer Subject: Re: Need help monitoring malloc() and free() Message-ID: <664459008@cricket.cs.duke.edu> Date: 21 Jan 91 11:56:50 GMT References: <1991Jan17.205108.3250@linus.mitre.org> <1991Jan20.185009.18694@cbnews.att.com> Followup-To: comp.lang.c Distribution: na Organization: Duke University Computer Science Dept.; Durham, N.C. Lines: 22 In article <1991Jan20.185009.18694@cbnews.att.com> res@cbnews.att.com (Robert E. Stampfli) writes: >>What I was thinking is making a front end to malloc() and free(), so >>all calls to malloc() would actually call my routine and my routine >>would in turn call the malloc() that lives in libc.a. > >Have you tried compiling your program with "-Dmalloc=Mymalloc -Dfree=Myfree" >on the compile line? Obviously, you leave this off the step that compiles >your liaison code -- the actual instance of Mymalloc() and Myfree(). An alternative would be to include the following lines at the beginning of the file containing your liaison code: #ifdef malloc #undef malloc #endif #ifdef free #undef free #endif This way, the "-Dmalloc=MyMalloc" defines could be specified with the CFLAGS macro in your makefile.