[fpc-pascal] Possible Memory Leak in TThread.Synchronize

Sven Barth pascaldragon at googlemail.com
Wed Jan 3 13:44:10 CET 2018


Am 03.01.2018 12:32 schrieb "Tony Whyman" <tony.whyman at mccallumwhyman.com>:


function CheckSynchronize(...)

and this ends with:

    else
      begin
      { for Queue entries we dispose the entry and raise the exception }
      Dispose(tmpentry);
      if Assigned(exceptobj) then
        raise exceptobj;
      end;
    tmpentry := PopThreadQueueHead;
    end;

The line "Dispose(tmpentry);" also disposes of a SynchronizeEvent but,
unlike TThread.DoneSynchronizeEvent, there is no RtlEventDestroy.

Am I correct in pointing the finger here for the memory leak?


I know you already found your problem, but nevertheless as explanation:
this code is only reached by asynchronously added events (TThread.Queue())
and there no event is needed, this none is freed or even allocated.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180103/da8422d6/attachment.html>


More information about the fpc-pascal mailing list