Since the process will be killed by OS and all memory allocated will be recycled anyway, is it OK not to free objects/resources in the unit finalization section?
For example,
unit Threading;
interface
implementation
var threadpool: ThreadPool;
initialization
threadpool := ThreadPool.Create;
finalization
threadpool.Free; // is it OK to remove this?
end.
Since the process will be killed by OS and all memory allocated will be recycled anyway, is it OK not to free objects/resources in the unit finalization section?
Yes, it is, probably. The system will clean up resources when the process terminates.
However, there are a couple of provisos: