Search code examples
delphifiremonkeydelphi-11-alexandria

TGPUObjectsPool memory leak on shutdown in Delphi 11.1 FMX


Running 11.1, I get this TGPUObjectsPool error on shutting down a simple basic FMX 2D app under Windows 64-bit (Release mode). First time I have seen this error.

Just running a blank form with ReportMemoryLeaksOnShutdown := True in project.dpr results in this error on closing.

There are no components on the TForm. Just run and close. It makes me wonder what kind of QA is done for a Delphi release if a basic empty project can close with such memory leaks.

Any solutions to get rid of this error?

---------------------------
Unexpected Memory Leak
---------------------------
An unexpected memory leak has occurred. The unexpected small block leaks are:

9 - 24 bytes: TGPUObjectsPool x 1    
89 - 104 bytes: TObjectDictionary<System.TClass,System.Generics.Collections.TObjectList<FMX.TextLayout.GPU.TReusableObject>> x 1

Solution

  • Try this:

    uses
    {$IFDEF VER350} // 11.x
      FMX.FontGlyphs,  FMX.TextLayout.GPU,
    {$ENDIF}
    
    finalization
    {$IFDEF VER350} // 11.x
      // RAD Studio 11 memory leak
      TFontGlyphManager.UnInitialize;
      TGPUObjectsPool.Uninitialize;
    {$ENDIF}