Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When is finalization method in unit called?

I have an app that recently crashed and I was able to get its callstack using EurekaLog. What I noticed is that an unit finalization was called but the app did not close and continued to work.

AFAIK, finalization sections are only called when the app terminates. But that was not what happened to me.

Does anyone knows why a finalization method was called when it was not supposed to do so?

EDIT

This app does not use any dlls or bpls.

EDIT2

Is it possible that a thread when finished could call finalization?

like image 892
Rafael Colucci Avatar asked May 04 '12 18:05

Rafael Colucci


1 Answers

Finalizations are called in two places. The most common one is when the application terminates. But they can also be called when a DLL (or BPL) is unloaded, which happens automatically when the application terminates but can also happen in the middle of the program running if the code explicitly unloads it.

Is it possible that that's what's going on?

like image 129
Mason Wheeler Avatar answered Oct 05 '22 17:10

Mason Wheeler