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

2018-01-03 Thread Sven Barth via fpc-pascal
Am 03.01.2018 12:32 schrieb "Tony Whyman" : 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

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

2018-01-03 Thread Tony Whyman
Thanks, I found the problem - the thread was not being destroyed correctly on completion and this manifested itself in what looked like a weird memory leak. On 03/01/18 11:49, Michael Van Canneyt wrote: On Wed, 3 Jan 2018, Tony Whyman wrote: The line "Dispose(tmpentry);" also disposes

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

2018-01-03 Thread Michael Van Canneyt
On Wed, 3 Jan 2018, Tony Whyman wrote: 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 doubt it, since AFAIK the RTL event is a OS

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

2018-01-03 Thread Tony Whyman
I have been investigating a possible memory leak in a multi-threading Lazarus program compiled with 3.0.4 where the stack trace with heaptrc shows: Heap dump by heaptrc unit 7014 memory blocks allocated : 131978472/131992352 7004 memory blocks freed : 114543216/114557096 10 unfreed memory