Recent

Author Topic: [solved] RadioGroupEx - unfreed memory  (Read 687 times)

Nicole

  • Hero Member
  • *****
  • Posts: 970
[solved] RadioGroupEx - unfreed memory
« on: March 01, 2023, 07:49:31 pm »
I hope, you can reproduce this as I work with frames and this was part of my form.

- add a RadioGroupEx to a frame which is created at runtime on a TPageControl TabSheet
- start the IDE by -gh
- start your project and close it down again.

everything is fine.

Now do nearly the same but

- populate the items with a bundle of strings, no matter how long or how many
- close down your application
- find 21 blocks of unfreed memory

reading

Code: Text  [Select][+][-]
  1. ---------------------------
  2. Error
  3. ---------------------------
  4. Heap dump by heaptrc unit of C:\project1.exe
  5.  
  6. 319743 memory blocks allocated : 20541338/21810992
  7.  
  8. 319722 memory blocks freed     : 20537810/21807464
  9.  
  10. 21 unfreed memory blocks : 3528
  11.  
  12. True heap size : 2916352 (160 used in System startup)
  13.  
  14. True free heap : 2907936
  15.  
  16. Should be : 2908632
  17.  
  18. Call trace for block $00000000037DBE70 size 64
  19.  
  20.   $0000000100012752
  21.  
  22.   $000000010000F46A
  23.  
  24.   $0000000100084EE5  CREATE,  line 23 of include/region.inc
  25.  
  26.   $000000010008AE4A  CREATE,  line 1513 of include/canvas.inc
  27.  
  28.   $00000001000A33CC  CREATE,  line 47 of include/controlcanvas.inc
  29.  
  30.   $00000001000C4285  CREATE,  line 26 of include/customcontrol.inc
  31.  
  32.   $00000001004354E4  CREATE,  line 670 of source/excheckctrls.pas
  33.  
  34.   $0000000100436E24  CREATE,  line 1266 of source/excheckctrls.pas
  35.  
  36.   $0000000100438AD2  UPDATEITEMS,  line 1910 of source/excheckctrls.pas
  37.  
  38.   $0000000100437A90  UPDATEINTERNALOBJECTLIST,  line 1608 of source/excheckctrls.pas
  39.  
  40.   $0000000100437C7E  CHANGED,  line 1659 of source/excheckctrls.pas
  41.  
  42.   $000000010004
  43. ---------------------------
  44. OK  
  45. ---------------------------
  46.  
  47.  
« Last Edit: March 02, 2023, 12:16:18 pm by Nicole »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2068
  • Fifty shades of code.
    • Delphi & FreePascal
Re: RadioGroupEx - unfreed memory
« Reply #1 on: March 01, 2023, 08:22:48 pm »
Do you create it at runtime with owner set? Showing is better than describing.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Nicole

  • Hero Member
  • *****
  • Posts: 970
Re: RadioGroupEx - unfreed memory
« Reply #2 on: March 01, 2023, 08:48:40 pm »
No, I did not.
Is is created at design-time including the item-polulation.

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: RadioGroupEx - unfreed memory
« Reply #3 on: March 01, 2023, 08:51:20 pm »
If you create an empty project except for a dynamically created TRadioGroupEx, you see the same 21-block memory leak on exiting the app.
There is no need to populate it with any items, or have a frame or pagecontrol/tabsheet.

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: RadioGroupEx - unfreed memory
« Reply #4 on: March 01, 2023, 09:58:00 pm »
Quick fix:  8-)
Code: Pascal  [Select][+][-]
  1. destructor TCustomRadioGroupEx.Destroy;
  2. begin
  3.   FreeThenNil(FHiddenButton);
  4.   inherited;
  5. end;

I had to download the package. I didn't even know ExCtrls exist.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: RadioGroupEx - unfreed memory
« Reply #5 on: March 01, 2023, 10:26:06 pm »
You can file a bugreport on the Lazars-CCR bugtracker, or contact user wp.

Bart

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: RadioGroupEx - unfreed memory
« Reply #6 on: March 01, 2023, 11:08:42 pm »
So I created bugreport #56.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: RadioGroupEx - unfreed memory
« Reply #7 on: March 01, 2023, 11:12:49 pm »
Fixed.

Nicole

  • Hero Member
  • *****
  • Posts: 970
Re: [solved] RadioGroupEx - unfreed memory
« Reply #8 on: March 02, 2023, 12:17:32 pm »
Thank you so much for the fix!
And here are all five frames fixed, which showed memory leaks.
Leaks are DONE in my project now.  :D

 

TinyPortal © 2005-2018