From: George Foot Newsgroups: comp.os.msdos.djgpp Subject: Re: malloc() bug? Date: 3 Dec 1997 05:42:27 GMT Organization: Oxford University, England Lines: 20 Message-ID: <662rg3$siq$1@news.ox.ac.uk> References: <97Nov27.183707gmt+0100 DOT 17029 AT internet01 DOT amc DOT de> <34844052 DOT 6481925 AT news DOT flash DOT net> <348450A7 DOT 7D2C5F5C AT cornell DOT edu> NNTP-Posting-Host: sable.ox.ac.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Tue, 02 Dec 1997 13:17:11 -0500 in comp.os.msdos.djgpp A. Sinan Unur wrote: : do a : #ifdef DEBUG : #define malloc my_debug_malloc : #define realloc my_debug_realloc : #define free my_debug_free I did something like this to make a simpler memory-leak detector (http://users.ox.ac.uk/~mert0407/downloads/findleak.zip). It's more useful IMHO if you do something like this: #define malloc(x) my_debug_malloc(x,__FILE__,__LINE__) etc Then you can output the source filename and line number to the debug file too, and match up the calls to the source code more easily. -- george DOT foot AT merton DOT oxford DOT ac DOT uk