The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,418 other followers

multithreading – Closure in TTask.Run(AnonProc) not released after AnonProc has finished – Stack Overflow

Posted by jpluimers on 2018/03/06

For my link archive: [WayBackmultithreading – Closure in TTask.Run(AnonProc) not released after AnonProc has finished – Stack Overflow

via: [WayBackHow 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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: