How to terminate anonymous threads in Delphi on application close?
问题 I have a Delphi application which spawns 6 anonymous threads upon some TTimer.OnTimer event. If I close the application from the X button in titlebar Access Violation at address $C0000005 is raised and FastMM reports leaked TAnonymousThread objects. Which is the best way to free anonymous threads in Delphi created within OnTimer event with TThread.CreateAnonymousThread() method? SOLUTION which worked for me: Created a wrapper of the anonymous threads which terminates them upon being Free-ed.