Date: Tue, 13 Jun 1995 15:36:32 +0300 From: eliz AT is DOT elta DOT co DOT il (Eli Zaretskii) To: Raphael DOT Quinet AT eed DOT ericsson DOT se Subject: Re: malloc without malice Cc: djgpp AT sun DOT soe DOT clarkson DOT edu > It's a pity that good software such as Purify is not freeware, because this > provides an invaluable help when debugging that kind of errors. I had > exactly the same problem today in a large program and I found the error in > two minutes with Pufiry 3.0. I know I would have spent several hours if I > didn't have that tool. Does anybody know if there is a freeware program (or > malloc library) offering the same features as Purify? There is a package called MALLOC_DEBUG. Though apparently not as powerful as Purify, it is still a valuable tool. The following was posted to the DJGPP mailing list about a year ago. (Note: I really suggest searching the DJGPP mailing list archives at http://www.delorie.com/djgpp/mail-archives/, you can find jewels like this in seconds without even asking the newsgroup.) ------------------------------------------------------------------------------- $Id: README,v 1.38 1994/03/20 17:13:33 gray Exp $ ------------------------------------------------------------------------------- MALLOC_DEBUG: The malloc_dbg library has been designed as a drop in replacement for the system's malloc, realloc, calloc, free and other memory management routines while providing powerful heap-memory debugging facilities. It is also reasonably portable having been successfully run on the following operating systems: BSDI, SunOS, Solaris, AIX, Ultrix, OSF, Irix, HPUX, and probably a couple others. ------------------------------------------------------------------------------- See the INSTALL file for installation notes. ------------------------------------------------------------------------------- ANTAIRE REPOSITORY: Currently, you can get the newest versions of the malloc_dbg library from anonymous ftp via ftp.antaire.com in the /antaire/src/malloc_dbg directory. The versions in this repository also include such files as a postscript version of the manual and other large files which may not have been included in the distribution you received. OTHER REPOSITORIES: You can also get a recent version from anonymous ftp via gatekeeper.dec.com in the /pub/misc/malloc_dbg directory. This repository has been made available through the generosity of the Digital Equipment Corporation with special help from Dave Hill and the gatekeepers. Thanks much to them all. ------------------------------------------------------------------------------- DOCUMENTATION: Examine the malloc.info file. Is is a gnu-info file having the user-documentation for the malloc subsystem. It can be installed in the emacs info directory and read with emacs/info or the info program available from the texinfo package at GNU archive sites. It is also suitable for reading as text. It can be reproduced from the malloc.texi texinfo file which also can generate TeX hardcopy output with the help of the texinfo.tex file. A malloc.ps postscript file may also have been included for you TeX-less folks. Important sections from malloc.info: * Overview:: General debugging concepts. * Debug Tokens:: Description of the debugging token flags. * Extensions:: Additional non-standard routines. * Malloc_dbg Program:: Env variable setting utility. * Debugging with the Library:: How to debug problems with the library ------------------------------------------------------------------------------- GENERAL: - the system is pretty dependent on a good ansi-c compiler like gcc. Non-ansi folks might have to: - add some sort of ansi option to your compiler. if there is one let me know and I will add it to the configure script. - first try 'make noansi' which will try and run the Deansify.pl perl script. It takes care of: - changing stdarg.h and ... to varargs.h and va_alist - changing all (void *) references to (char *). - fixing all functions to remove foo(char * var) decls. - if it doesn't work you may have to do Deansify.pl's job by hand. - the file Manifest contains a list of each of the files and what it does. - configure can be regenerated by the autoconf script (versions 1.6 and above) - this malloc has never been (and maybe never will be) optimized for space nor speed. it is *very* wasteful and while handling large allocations or tons of concurrent small allocations, the heap can quickly become huge. -------------------------------------------------------------------------------