For my link archive: [WayBack] multithreading – Closure in TTask.Run(AnonProc) not released after AnonProc has finished – Stack Overflow
via: [WayBack] How the combination of inline, interfaces and missing RVO can break your code – Stefan Glienke – Google+
TL;DR from RAD StudioRSP-12462 TThreadPool worker thread holds reference to last executed task by Asbjørn Heid as a regression since XE8:
A temporary variable in TThreadPool.TQueueWorkerThread.Execute keeps a reference to the last executed work-item (task), which is only released when the Execute method ends.
Being in a pool the thread is usually kept alive until the pool is destroyed, which for the Default pool means during finalization of the unit. Thus the last executed tasks are not released until the program terminates.
–jeroen