memory leak in Thread.Queue
Original Reporter info from Mantis: Martin @martin_frb
-
Reporter name: Martin Friebe
Original Reporter info from Mantis: Martin @martin_frb
- Reporter name: Martin Friebe
Description:
If 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.
Mantis conversion info:
- Mantis ID: 35028
- OS: win 10
- OS Build: 10
- Platform: 64bit Intel
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 41280 (#1502a13e)
- Monitored by: » crossbuilder (Burkhard Carstens), » Artem3213212 (Artem3213212), » AntonK (Anton Kavalenka)