Possible obscure causes for Abstract Error in Delphi?

Escape Velocity picture Escape Velocity · Aug 12, 2012 · Viewed 11.1k times · Source

In a Delphi 7 project we installed FastMM. Soon after that we noticed one of the forms started to issue Abstract Error message on close. I have debugged this extensively and I can't find the reason so far. The usual reason for this error message doesn't seem to apply here. The application doesn't define abstract classes. I also searched the form for a possible use of TStrings or something like that. Most importantly, we didn't (well, we think we didn't) make any changes to this form. It just broke.

  1. Are there some other possible causes for this error besides trying to call unimplemented method?
  2. Is there some possibilty that FastMM has enabled some obscure bug in the application, that remained hidden until now?

If the answer to these questions is no, then I'll just continue to search for an unimplemented method call, relieved that I am not missing something else.

Answer

Ville Krumlinde picture Ville Krumlinde · Aug 12, 2012

If there is memory corruption then all sort of errors can be raised and it is very difficult to find the cause.

To answer your questions: 1) Yes abstract error can also be caused by memory corruption, and 2) Yes enabling FastMM can make bugs visible that normally pass unnoticed (but should still be fixed).

Some general advice for finding memory errors:

  1. Try "FullDebugMode" setting in FastMM.
  2. Make sure everything you Create is matched with a Free.
  3. Make sure nothing is freed more than once.
  4. Make sure an object is not used after it has been freed (or before it has been created).
  5. Turn on hints and warnings (and fix them when they occur).