Search code examples
delphidelphi-xe

Delphi Runtime error 216 thrown in SysUtils.FinaliseUnits, line number not in mapfile


I have a random Runtime Error 216 that appears on application close.

I have debugged as far as I can and the error is thrown in SysUtils.FinalizeUnits.

I have gone over the code and ensure all created objects are freed.

The number on the runtime error, 0040054A, is not present in the mapfile. Do you know what this means?

Can anyone tell me how to find out what is throwing the error?


Solution

  • I'd suspect a memory leak (all Runtime Errors 216 I've encountered so far were) and use a profiler (visual inspection is never as good as a tool). Since you're using Delphi XE, you should give AQTime a try (it's included), see also

    Delphi - Check if memory is being released "on time"

    Kind regards, Frank