2

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
Dalija Prasnikar
  • 27,212
  • 44
  • 82
  • 159
Peter Jones
  • 451
  • 2
  • 12
  • 1
    @RemyLebeau oh thanks for the link! I googled and didn't find a single link to TGPUObjectsPool . I guess maybe they should consider having their samples include the ReportMemoryLeaksOnShutdown=True. After all, it's samples, so the extra link won't hurt. – Peter Jones Mar 21 '22 at 07:01
  • 2
    "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." That kind of rant isn't appropriate in a SO question, but I ask the same question. I absolutely understand your frustration, and I have recently been rather active in Embarcadero's Jira about quality issues. The good thing is that I feel that Embarcadero *is listening* and improving. – Andreas Rejbrand Mar 21 '22 at 09:40

3 Answers3

6

It makes me wonder what kind of QA is done for a Delphi release

A lot, actually. Months of beta testing, lots of fixes and internal builds.

This issue was actually reported during testing, but only just a couple of weeks ago, after it was too late to fix for the final release. But, this leak (and others) have been reported publicly after 11.1 was released:

RSP-37596 FMX TFontGlyphManager's UnInitialize not called in finalization

RSP-37600 Unexpected Memory Leak in TGPUObjectsPool

RSP-37613 Memory leak in an application that only serves forms

RSP-37656 Memory leak in FMX (simple project)

And there are other similar memory leaks (in TFontGlyphManager, TBehaviorServices, etc), so hopefully this will get fixed in the next update.

I guess maybe they should consider having their samples include the ReportMemoryLeaksOnShutdown=True.

Funny, because I see a similar report for that, too:

RSP-37598 Make RTL, FMX and VCL developers turn on memory leak checking by default

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • 1
    I think quite a number of people share the sentiments that memory leak checking can be added by default; it's easy to turn it off anyway. – Peter Jones Mar 21 '22 at 07:23
  • 1
    "A lot, actually. Months of beta testing, lots of fixes and internal builds." That might be true, but there is a "but". I had to make a FMX app a few months ago, and during the first week of development, I "accidentally" discovered about 50 FMX bugs, some quite nasty. Most I discovered within an hour. (For instance, every time you press the Win key on your keyboard, the currently selected Object Inspector field gets replaced by a [ bracket.) About half of them I reported to Embarcadero, and some were fixed in 11.1. So maybe there is testing going on, but I do understand the OP's frustration. – Andreas Rejbrand Mar 21 '22 at 09:30
  • Or the 10.3 titlebar which disintegrated into several parts with random locations on the screen when you maximized the IDE. That I discovered within a second the first time I started the 10.3 IDE. (I am autistic, so maybe "normal" people don't notice things like that.) – Andreas Rejbrand Mar 21 '22 at 09:34
  • @AndreasRejbrand, I wonder if you would make for a good beta tester - if you actually are a interested. – Uwe Raabe Mar 21 '22 at 10:03
  • 2
    @UweRaabe: I would love to help out if asked. – Andreas Rejbrand Mar 21 '22 at 10:04
  • 1
    @AndreasRejbrand users with an active subscription are openly invited to join betas before releases. – Remy Lebeau Mar 21 '22 at 14:52
  • @RemyLebeau: Okay, I use CE at home and am not responsible for the license at my company. That explains why I didn't know about that. – Andreas Rejbrand Mar 21 '22 at 14:56
2

I fixed it (as a workaround) including ShareMem as first unit in uses in my project source.

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 16 '22 at 01:16
1

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}
NBuyer
  • 36
  • 2
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Cristik Apr 18 '22 at 04:31
  • @NBuyer This actually works elegantly without changing the source of FMX.TextLayout.GPU.pas - I'm using this for now. Thanks for the post! Just a small note to include a blank initialization section above finalization for code to compile. – Peter Jones May 19 '22 at 14:52