Debugging Applications for MicrosoftВ® .NET and Microsoft WindowsВ® (Pro-Developer)
|
The debug C run-time library has many wonderful features—provided you turn them on in your application. Because using memory is a fact of life in our C and C++ programs, we need all the help we can get solving the problems we invariably have with memory. This chapter covered the high points of the DCRT library and presented two utilities I wrote, MemDumperValidator and MemStress, that will help you get more information about the memory your application uses and allow you to better test your application under stressful conditions.
The extensibility of the DCRT library is pretty amazing. If you've been in this business for more than a year or two, you've probably written something like it in the past. I hope I was able to give you some sense of the power of the DCRT library. I encourage you to devise other utilities and helper code that will ease your memory debugging chores.
I also discussed the techniques and tools necessary to handle the nastiest of memory problems in production applications: uninitialized writes and memory overruns. Although the brute force approach might not seem elegant for solving those uninitialized writes, it's the only technique that actually gives you a chance. When it comes to memory overruns, the PageHeap tool accessible from AppVerifier, part of the Application Compatibility Toolkit, makes tracking them down easier. Although AppVerifier has some lumps, I'm sure Microsoft will continue to improve it in the future. Finally, the new Run-Time Error Checks and Buffer Security Check compiler switches are some of the most important advances we've had in compiler tools to help eradicate errors.
|