SafeMM Debug Memory Manager available on CodeCentral

Posted by on in Blogs
In my CodeRage talk,  Debugging Techniques for Delphi, I gave a short demo of using 2 different debug heap managers to help track down memory issues.  In the demo, I showed FastMM and another memory manager called SafeMM.  FastMM has been around for a number of years, and I'm sure many of you have used it in the "fulldebug" mode to help find memory errors.  SafeMM, on the other hand, has only been available publicly since my CodeRage session.  The source files are available on CodeCentral.

SafeMM works by not immediately re-using freed blocks and using the page protection flags that are part of the operating system.  It does an excellent job of detecting reads and writes beyond the boundaries of a memory block as well as any access to freed memory.   FastMM can also detect these types of errors, but it doesn't typically detect them right when they occur.

Because of the way it is designed, SafeMM will require significantly more memory than the normal memory manager and typically cannot be used for extended periods of time without causing "out of memory" errors.   For best results, try to use SafeMM to test a very specific set of steps for a failure.

If you have an elusive bug that you suspect may be related to heap corruption give SafeMM a try.  It works great.

Many thanks to Ben Taylor for giving permission to share this useful debugging tool with the Delphi / C++ Builder community!

P.S. If you want to see just the debug memory manager demo from the CodeRage talk you can fast forward to about the 23 minute mark.
Comments are not available for public users. Please login first to view / add comments.