View Issue Details

IDProjectCategoryView StatusLast Update
0035028FPCRTLpublic2019-07-19 10:07
ReporterMartin FriebeAssigned ToSven Barth 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platform64bit IntelOSwin 10OS Version10
Product Version3.3.1Product Build 
Target VersionFixed in Version3.3.1 
Summary0035028: memory leak in Thread.Queue
DescriptionIf TThread.Queue is called in the main thread, then the event is executed immediately (rather than being queued for the next CheckSynchronize).

This is ok, but if the event throws on exception, then the memory for the event record is leaked:

procedure ThreadQueueAppend
....

  if (GetCurrentThreadID = MainThreadID) and (not aQueueIfMain or not IsMultiThread) then
{$endif}
  begin
    ExecuteThreadQueueEntry(aEntry);
    if not Assigned(aEntry^.SyncEvent) then
      Dispose(aEntry);
{$ifdef FPC_HAS_FEATURE_THREADING}
  end else begin


If in ExecuteThreadQueueEntry an exception occurs, then Dispose is never called.

In CheckSyncronize, the exception is caught, stored, and re-raised *afted* the dispose.
TagsNo tags attached.
Fixed in Revision41280
FPCOldBugId0
FPCTarget
Attached Files

Activities

Sven Barth

2019-02-10 16:43

manager   ~0114011

Please test and close if okay.

Issue History

Date Modified Username Field Change
2019-02-06 22:37 Martin Friebe New Issue
2019-02-10 16:43 Sven Barth Fixed in Revision => 41280
2019-02-10 16:43 Sven Barth Note Added: 0114011
2019-02-10 16:43 Sven Barth Status new => resolved
2019-02-10 16:43 Sven Barth Fixed in Version => 3.3.1
2019-02-10 16:43 Sven Barth Resolution open => fixed
2019-02-10 16:43 Sven Barth Assigned To => Sven Barth
2019-02-10 21:44 Martin Friebe Status resolved => closed