Date: Tue, 13 Jun 95 17:34 MDT From: mat AT ardi DOT com (Mat Hostetter) To: Raphael DOT Quinet AT eed DOT ericsson DOT se (Raphael Quinet) Cc: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: malloc without malice Newsgroups: comp.os.msdos.djgpp References: <2fdc5b86 DOT sandmann AT clio DOT rice DOT edu> <3ri2i8$5s AT erinews DOT ericsson DOT se> Cc: cottons AT ardi DOT com, ctm AT ardi DOT com >>>>> "Raphael" == Raphael Quinet writes: Raphael> It's a pity that good software such as Purify is not Raphael> freeware, because this provides an invaluable help when Raphael> debugging that kind of errors. I had exactly the same Raphael> problem today in a large program and I found the error in Raphael> two minutes with Pufiry 3.0. I know I would have spent Raphael> several hours if I didn't have that tool. Does anybody Raphael> know if there is a freeware program (or malloc library) Raphael> offering the same features as Purify? A similar free package exists for Linux; it's called "Checker". The basic idea is this: Each byte in the program's address space has associated with it a read permission bit and a write permission bit. Checker replaces gas (the assembler) with a modified version that wraps each memory-referencing asm instruction with a call to a small stub that verifies that the memory has the appropriate read, write, or read/write permissions, and modifies those permissions. Checker also provides a special "Checker-aware" malloc library. We (ARDI) started playing with Checker a few weeks ago to help us track down bugs in Executor, our commercial Macintosh emulator for DOS, Linux, and NEXTSTEP. Checker was a good idea, but it doesn't seem to have been extensively tested or optimized. We found many bugs in Checker and it was so slow as to be unusable (for our particular needs). cottons AT ardi DOT com (with a little help from me) has fixed the bugs and sped up Checker enormously. We've already found some really sneaky bugs in Executor, and we expect to find more once we make Executor's internal memory-management system use Checker facilities aggressively. Once we are confident our version is stable, we'll send the new sources to Checker's original author and hopefully he will make them the latest official release. Of course, Checker only works for Linux (right now), but many djgpp developers also have access to Linux systems. It could in principle be ported to djgpp, but there are some tricky issues involving segment overrides and such which don't crop up under Linux. -Mat