Method to track down exceptions memory / object problems
Posted on 2006-05-24
I have written a DLL that handles printing from our application using Gnostice Tools, creating PDFs. I create a lot of objects on the fly from tables, from streams, there are datamodules and datasets created from information in a database....it is more than slightly complex. And it works pretty darn well. However, when I leave the calling application I get first:
The exception unknown software exception (0x0eedfade) occurred in the application at location )x7c81eb33
and then 21 instances of:
The instruction at 0x01ef32df referenced memory at "0x00000000". The memory could not be read.
After that everything is fine. When I am testing this within Delphi calling my DLL from a simpler calling program, I get a wonderful clunk/thunk sound as I exit the program, but no error (I assume the clunk is the indicator that it is having a similar issue).
So, the question is, what is a reasonably efficient way to track down what I am doing wrong. I assume that I have references to objects that are owned, but no longer exist. I have tried commenting out code, stepping through the close down process, changing all of my .Free to FreeAnNil.
I'd like to solve this without having to look at and retry every line of code.
I need a method to track this down.
I can send code, but there is a lot of it, and really, I would prefer a method that I will be able to use in the future.
As an added piece of information, I do use interfaces on a number of my objects, but I don't think I am freeing any of those (could be wrong). The problem is there are only 21 errors and I have hundreds of objects so I'm not thinking that is the problem. But I'm open to suggestion at this point.