Frage

This is with Delphi XE2 and FastMM 4.99, and a 32-bit program on a Win7-64 machine.

I was trying to use FastMM to check a smallish program I've been working on. The program includes a data module that is on the project's auto-created forms list. The data module contains only a TADOConnection object.

When I enable FullDebugMode in FastMM, I get an invalid typecast error when exiting the program. The culprit seems to be in freeing the datamodule (the error occurs in TADOConnection.GetADODataSet). Can anyone suggest why this is happening?

War es hilfreich?

Lösung

It turns out that the problem was just something that was exposed by FastMM, not caused by it.

Specifically, I'd subclassed TADOQuery for use with the data module. I remembered to write a destructor override for the class, but failed to call the inherited dtor. Probably this was causing the TADOConnection to do something undefined.

Andere Tipps

Without more information, it's hard to say exactly, but when you're having problems when freeing something, it's usually because it's trying to free something that's already been freed. Try placing a few breakpoints to see if any of the classes involved are getting freed before you see this error. If so, that should help you track it down.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top