|Hosting by PhotoTangler Collage Maker|
Presenting A Memory Manager
Question submitted by n/a (12 September 2000)
|Return to The Archives|
|This entry is not a response to a question.|
This installment of the Ask Midnight column is not in response to a question,
but rather a follow-up to the last question about memory management & tracking.
I've spent the past week developing and testing a new industrial-grade memory
During this effort, I found three bugs in an application I thought to be bug-free (at least, as far as memory usage goes.) I had this confidence because I often run with BoundsChecker (as well as the memory tracking tools in the Microsoft libraries.) Neither of these tools was able to locate these particular bugs, so I assumed the bugs didn't actually exist. As it turns out, the memory manager presented here located them and told me exactly where to go to fix them. As a result, I now have a little more confidence in the application I was testing with, and even more confidence in my memory tracker. Here's what this memory tracker told me:
Is your code bug-free? Take the Memory Manager challenge! I urge you to include this software in your projects as a test. If your projects have any size to them at all, or use memory in a multitude of various ways, then this memory tracker may very likely find bugs in your code that you never knew were there. Just include this software with your project, include the MMGR.H file in each of your source files and recompile. After each run, check for any MEM*.LOG files in the project's directory. If you really want to test your software, simply edit MMGR.CPP and uncomment the STRESS_TEST macro. This will slow your allocations down a bit, but it's worth it. And finally, spend a couple minutes and read the comments at the top of the MMGR.CPP file.
If this code helps you find bugs you never knew existed or helps you track down a tough bug, then please visit this issue of Ask Midnight and leave a testimonial in the comments. I will periodically check them and may eventually release an updated version of this software based on your comments.
Download The Memory Manager: [mmgr.zip (15k)]
So go ahead. Take the challenge. I dare you. :)
Response provided by Paul Nettle
This article was originally an entry in flipCode's Ask Midnight, a Question and Answer column with Paul Nettle that's no longer active.