I just installed Delphi 10.2 Release 1. When I recompiled my applications and ran them, I get a lot of memory leaks. I had no memory leaks with 10.2 (without the update). I made no changes to the code either.
To verify, I created a simple blank application and put a few components on the form. No code. Ran the application and got memory leaks reported.
I wanted to highlight this (if only as a warning before you upgrade).
My questions:
Note: I have logged an issue on quality portal, just in case this is a real issue: https://quality.embarcadero.com/browse/RSP-18774. In this ticket I have also attached the sample app.
After some investigation I found out that the callbacks being passed to TThread.CurrentThread.ForceQueue
in TStyledControl.KillResourceLink
are never executed because before any thread can handle them the application is ending and the TThread
class destructor is destroying the list that still has unhandled callbacks.
I solved this by adding a call to CheckSynchronize
at the end of FMX.Forms.DoneApplication
which forces the callbacks to be executed which resolved the huge memory leak.
I don't know if this is the correct fix for the issue but it solved the memory leaks being reported.