Recent

Author Topic: Memory leak in form with no code  (Read 784 times)

Wilko500

  • Full Member
  • ***
  • Posts: 101
Memory leak in form with no code
« on: September 07, 2024, 10:27:25 pm »
This is a follow on from my previous post about memory leak. I took my project and removed all units, forms and code so that all that remained was the main form. Run the form and exit using a command button and record the hepatic output.  On this project I get a consistent 8 unfree blocks. The rule seems to be If I create it then I free it. But I didn't create it, did I?
I attach screen shot of the form, the form code, and Heaptrc output.

I note that both the following lines referred to in the output are lines that do a create. Now I'm stuck
Code: Pascal  [Select][+][-]
  1. line 21 of PvUploadTest.lpr
  2. line 375 of cocoa/cocoaconfig.pas

I would appreciate some insight into understanding this heaptrc output and how to fix the leak.
Code: Pascal  [Select][+][-]
  1. object frmAuroraDataUpload: TfrmAuroraDataUpload
  2.   Left = 254
  3.   Height = 677
  4.   Top = 116
  5.   Width = 855
  6.   BorderStyle = bsDialog
  7.   BorderWidth = 4
  8.   Caption = 'PvUploadTest'
  9.   ClientHeight = 677
  10.   ClientWidth = 855
  11.   Color = 14079702
  12.   Position = poScreenCenter
  13.   object ListView1: TListView
  14.     Left = 25
  15.     Height = 122
  16.     Top = 120
  17.     Width = 690
  18.     Columns = <    
  19.       item
  20.         Caption = 'Date'
  21.         Width = 102
  22.       end    
  23.       item
  24.         Caption = 'Power'
  25.         Width = 88
  26.       end    
  27.       item
  28.         Caption = 'Energy'
  29.         Width = 90
  30.       end    
  31.       item
  32.         Caption = 'Peak'
  33.         Width = 66
  34.       end>
  35.     Font.CharSet = ANSI_CHARSET
  36.     Font.Height = -11
  37.     Font.Name = 'Tahoma'
  38.     HideSelection = False
  39.     ParentFont = False
  40.     ReadOnly = True
  41.     ScrollBars = ssVertical
  42.     TabOrder = 0
  43.   end
  44.   object Label7: TLabel
  45.     Left = 24
  46.     Height = 14
  47.     Top = 100
  48.     Width = 73
  49.     Caption = 'Power History'
  50.     Font.CharSet = ANSI_CHARSET
  51.     Font.Color = clBlack
  52.     Font.Height = -12
  53.     Font.Name = 'Tahoma'
  54.     ParentFont = False
  55.   end
  56.   object cmdSettings: TButton
  57.     Left = 725
  58.     Height = 25
  59.     Top = 120
  60.     Width = 97
  61.     Caption = 'Settings'
  62.     Font.CharSet = ANSI_CHARSET
  63.     Font.Height = -13
  64.     Font.Name = 'Tahoma'
  65.     ParentFont = False
  66.     TabOrder = 1
  67.     OnClick = cmdSettingsClick
  68.   end
  69.   object Button2: TButton
  70.     Left = 24
  71.     Height = 25
  72.     Top = 633
  73.     Width = 98
  74.     Caption = 'Re-Scan'
  75.     Font.CharSet = ANSI_CHARSET
  76.     Font.Height = -13
  77.     Font.Name = 'Helvetica Neue'
  78.     ParentFont = False
  79.     TabOrder = 2
  80.   end
  81.   object Button3: TButton
  82.     Left = 725
  83.     Height = 25
  84.     Top = 633
  85.     Width = 98
  86.     Caption = 'Re-Load'
  87.     Font.CharSet = ANSI_CHARSET
  88.     Font.Height = -13
  89.     Font.Name = 'Helvetica Neue'
  90.     ParentFont = False
  91.     TabOrder = 3
  92.   end
  93.   object Label10: TLabel
  94.     Left = 24
  95.     Height = 16
  96.     Top = 258
  97.     Width = 96
  98.     AutoSize = False
  99.     Caption = 'Days Logged'
  100.     Font.CharSet = ANSI_CHARSET
  101.     Font.Height = -12
  102.     Font.Name = 'Tahoma'
  103.     ParentFont = False
  104.   end
  105.   object Label11: TLabel
  106.     Left = 725
  107.     Height = 16
  108.     Top = 258
  109.     Width = 97
  110.     AutoSize = False
  111.     Caption = 'Days UpLoaded'
  112.     Font.CharSet = ANSI_CHARSET
  113.     Font.Height = -12
  114.     Font.Name = 'Tahoma'
  115.     ParentFont = False
  116.   end
  117.   object Label12: TLabel
  118.     Left = 143
  119.     Height = 16
  120.     Top = 258
  121.     Width = 95
  122.     AutoSize = False
  123.     Caption = 'File Scan Errors'
  124.     Font.CharSet = ANSI_CHARSET
  125.     Font.Height = -12
  126.     Font.Name = 'Tahoma'
  127.     ParentFont = False
  128.   end
  129.   object Label13: TLabel
  130.     Left = 434
  131.     Height = 16
  132.     Top = 258
  133.     Width = 112
  134.     AutoSize = False
  135.     Caption = 'Data UpLoad Errors'
  136.     Font.CharSet = ANSI_CHARSET
  137.     Font.Height = -12
  138.     Font.Name = 'Tahoma'
  139.     ParentFont = False
  140.   end
  141.   object lblFileScan: TLabel
  142.     Left = 272
  143.     Height = 16
  144.     Top = 258
  145.     Width = 144
  146.     Alignment = taRightJustify
  147.     AutoSize = False
  148.     Caption = 'Next Scan in xx.xx secs'
  149.     Font.CharSet = ANSI_CHARSET
  150.     Font.Height = -12
  151.     Font.Name = 'Tahoma'
  152.     ParentFont = False
  153.   end
  154.   object lblPvUpload: TLabel
  155.     Left = 544
  156.     Height = 16
  157.     Top = 258
  158.     Width = 162
  159.     Alignment = taRightJustify
  160.     AutoSize = False
  161.     Caption = 'Next UpLoad in xx.xx secs'
  162.     Font.CharSet = ANSI_CHARSET
  163.     Font.Height = -12
  164.     Font.Name = 'Tahoma'
  165.     ParentFont = False
  166.   end
  167.   object Label16: TLabel
  168.     Left = 143
  169.     Height = 16
  170.     Top = 462
  171.     Width = 88
  172.     AutoSize = False
  173.     Caption = 'FileScan Log'
  174.     Font.CharSet = ANSI_CHARSET
  175.     Font.Height = -12
  176.     Font.Name = 'Tahoma'
  177.     ParentFont = False
  178.   end
  179.   object Label17: TLabel
  180.     Left = 434
  181.     Height = 16
  182.     Top = 462
  183.     Width = 86
  184.     AutoSize = False
  185.     Caption = 'UpLoad Log'
  186.     Font.CharSet = ANSI_CHARSET
  187.     Font.Height = -12
  188.     Font.Name = 'Tahoma'
  189.     ParentFont = False
  190.   end
  191.   object cmdStart: TButton
  192.     Left = 725
  193.     Height = 25
  194.     Top = 152
  195.     Width = 97
  196.     Caption = 'Start'
  197.     Font.CharSet = ANSI_CHARSET
  198.     Font.Height = -13
  199.     Font.Name = 'Tahoma'
  200.     ParentFont = False
  201.     TabOrder = 4
  202.     OnClick = cmdStartClick
  203.   end
  204.   object cmdStop: TButton
  205.     Left = 725
  206.     Height = 25
  207.     Top = 188
  208.     Width = 97
  209.     Caption = 'Stop'
  210.     Enabled = False
  211.     Font.CharSet = ANSI_CHARSET
  212.     Font.Height = -13
  213.     Font.Name = 'Tahoma'
  214.     ParentFont = False
  215.     TabOrder = 5
  216.     OnClick = cmdStopClick
  217.   end
  218.   object cmdfrmAuroraExit: TButton
  219.     Left = 725
  220.     Height = 20
  221.     Top = 224
  222.     Width = 97
  223.     Caption = 'Exit'
  224.     Font.CharSet = ANSI_CHARSET
  225.     Font.Height = -13
  226.     Font.Name = 'Tahoma'
  227.     ParentFont = False
  228.     TabOrder = 6
  229.     OnClick = cmdfrmAuroraExitClick
  230.   end
  231.   object RmLoggedDays: TRichMemo
  232.     Left = 24
  233.     Height = 354
  234.     Top = 276
  235.     Width = 98
  236.     Font.CharSet = ANSI_CHARSET
  237.     Font.Height = -12
  238.     Font.Name = 'Tahoma'
  239.     HideSelection = False
  240.     ParentFont = False
  241.     ScrollBars = ssVertical
  242.     TabOrder = 7
  243.     ZoomFactor = 1
  244.   end
  245.   object RmUploadDays: TRichMemo
  246.     Left = 725
  247.     Height = 354
  248.     Top = 276
  249.     Width = 98
  250.     Font.CharSet = ANSI_CHARSET
  251.     Font.Height = -12
  252.     Font.Name = 'Tahoma'
  253.     HideSelection = False
  254.     ParentFont = False
  255.     ScrollBars = ssVertical
  256.     TabOrder = 8
  257.     ZoomFactor = 1
  258.   end
  259.   object RmFileScanError: TRichMemo
  260.     Left = 136
  261.     Height = 180
  262.     Top = 276
  263.     Width = 279
  264.     Font.CharSet = ANSI_CHARSET
  265.     Font.Height = -12
  266.     Font.Name = 'Tahoma'
  267.     HideSelection = False
  268.     ParentFont = False
  269.     ScrollBars = ssVertical
  270.     TabOrder = 9
  271.     ZoomFactor = 1
  272.   end
  273.   object RmPvUploadError: TRichMemo
  274.     Left = 430
  275.     Height = 180
  276.     Top = 276
  277.     Width = 284
  278.     Font.CharSet = ANSI_CHARSET
  279.     Font.Height = -12
  280.     Font.Name = 'Tahoma'
  281.     HideSelection = False
  282.     ParentFont = False
  283.     ScrollBars = ssVertical
  284.     TabOrder = 10
  285.     ZoomFactor = 1
  286.   end
  287.   object RmFileScanLog: TRichMemo
  288.     Left = 136
  289.     Height = 180
  290.     Top = 478
  291.     Width = 279
  292.     Font.CharSet = ANSI_CHARSET
  293.     Font.Height = -12
  294.     Font.Name = 'Tahoma'
  295.     HideSelection = False
  296.     ParentFont = False
  297.     ScrollBars = ssVertical
  298.     TabOrder = 11
  299.     ZoomFactor = 1
  300.   end
  301.   object RmPvUploadLog: TRichMemo
  302.     Left = 430
  303.     Height = 180
  304.     Top = 478
  305.     Width = 284
  306.     Font.CharSet = ANSI_CHARSET
  307.     Font.Height = -12
  308.     Font.Name = 'Tahoma'
  309.     HideSelection = False
  310.     ParentFont = False
  311.     ScrollBars = ssVertical
  312.     TabOrder = 12
  313.     ZoomFactor = 1
  314.   end
  315.   object Panel2: TPanel
  316.     Left = 40
  317.     Height = 20
  318.     Top = 38
  319.     Width = 72
  320.     Caption = 'System'
  321.     ClientHeight = 20
  322.     ClientWidth = 72
  323.     Color = 14079702
  324.     ParentBackground = False
  325.     ParentColor = False
  326.     TabOrder = 13
  327.     object lblCurDate: TLabel
  328.       Left = 688
  329.       Height = 16
  330.       Top = 8
  331.       Width = 152
  332.       Alignment = taRightJustify
  333.       AutoSize = False
  334.       Caption = '12:54:23 on 15 July 2025'
  335.       Font.CharSet = ANSI_CHARSET
  336.       Font.Height = -12
  337.       Font.Name = 'Tahoma'
  338.       ParentFont = False
  339.     end
  340.   end
  341.   object Button1: TButton
  342.     Left = 725
  343.     Height = 25
  344.     Top = 88
  345.     Width = 75
  346.     Caption = 'Button1'
  347.     TabOrder = 14
  348.     OnClick = Button1Click
  349.   end
  350.   object Label18: TLabel
  351.     Left = 726
  352.     Height = 15
  353.     Top = 32
  354.     Width = 96
  355.     Alignment = taCenter
  356.     AutoSize = False
  357.     Caption = ' Web  View'
  358.     Font.CharSet = ANSI_CHARSET
  359.     Font.Color = clBlack
  360.     Font.Height = -12
  361.     Font.Name = 'Tahoma'
  362.     Font.Style = [fsUnderline]
  363.     ParentFont = False
  364.   end
  365.   object Button8: TButton
  366.     Left = 780
  367.     Height = 20
  368.     Top = 64
  369.     Width = 42
  370.     Caption = 'Hide'
  371.     Font.CharSet = ANSI_CHARSET
  372.     Font.Height = -13
  373.     Font.Name = 'Tahoma'
  374.     ParentFont = False
  375.     TabOrder = 15
  376.   end
  377.   object Button7: TButton
  378.     Left = 725
  379.     Height = 20
  380.     Top = 64
  381.     Width = 48
  382.     Caption = 'Show'
  383.     Font.CharSet = ANSI_CHARSET
  384.     Font.Height = -13
  385.     Font.Name = 'Tahoma'
  386.     ParentFont = False
  387.     TabOrder = 16
  388.   end
  389.   object lblVer: TLabel
  390.     Left = 520
  391.     Height = 16
  392.     Top = 26
  393.     Width = 104
  394.     AutoSize = False
  395.     Caption = 'Version 1.12.34'
  396.     Font.CharSet = ANSI_CHARSET
  397.     Font.Height = -12
  398.     Font.Name = 'Helvetica'
  399.     Font.Style = [fsItalic]
  400.     ParentFont = False
  401.   end
  402.   object lblTitle: TLabel
  403.     Left = 310
  404.     Height = 25
  405.     Top = 14
  406.     Width = 201
  407.     Caption = 'Aurora Data Uploader'
  408.     Font.CharSet = ANSI_CHARSET
  409.     Font.Height = -21
  410.     Font.Name = 'Tahoma'
  411.     ParentFont = False
  412.   end
  413.   object Panel1: TPanel
  414.     Left = 25
  415.     Height = 30
  416.     Top = 50
  417.     Width = 681
  418.     BevelOuter = bvNone
  419.     BorderWidth = 1
  420.     BorderStyle = bsSingle
  421.     ClientHeight = 28
  422.     ClientWidth = 679
  423.     Font.CharSet = ANSI_CHARSET
  424.     Font.Height = -13
  425.     Font.Name = 'Avenir Next'
  426.     ParentBackground = False
  427.     ParentColor = False
  428.     ParentFont = False
  429.     TabOrder = 17
  430.     object Label3: TLabel
  431.       Left = 8
  432.       Height = 18
  433.       Top = 8
  434.       Width = 39
  435.       AutoSize = False
  436.       Caption = 'Name :'
  437.       Font.CharSet = ANSI_CHARSET
  438.       Font.Height = -12
  439.       Font.Name = 'Tahoma'
  440.       ParentFont = False
  441.     end
  442.     object Label4: TLabel
  443.       Left = 280
  444.       Height = 18
  445.       Top = 8
  446.       Width = 86
  447.       AutoSize = False
  448.       Caption = 'Inverter model :'
  449.       Font.CharSet = ANSI_CHARSET
  450.       Font.Height = -12
  451.       Font.Name = 'Tahoma'
  452.       ParentFont = False
  453.     end
  454.     object Label5: TLabel
  455.       Left = 512
  456.       Height = 18
  457.       Top = 8
  458.       Width = 75
  459.       AutoSize = False
  460.       Caption = 'System Date :'
  461.       Font.CharSet = ANSI_CHARSET
  462.       Font.Height = -12
  463.       Font.Name = 'Tahoma'
  464.       ParentFont = False
  465.     end
  466.     object lblSystemName: TLabel
  467.       Left = 50
  468.       Height = 18
  469.       Top = 8
  470.       Width = 136
  471.       AutoSize = False
  472.       Caption = 'lblSystemName'
  473.       Font.CharSet = ANSI_CHARSET
  474.       Font.Height = -12
  475.       Font.Name = 'Tahoma'
  476.       ParentFont = False
  477.     end
  478.     object lblInvModel: TLabel
  479.       Left = 370
  480.       Height = 18
  481.       Top = 8
  482.       Width = 136
  483.       AutoSize = False
  484.       Caption = 'lblInvModel'
  485.       Font.CharSet = ANSI_CHARSET
  486.       Font.Height = -12
  487.       Font.Name = 'Tahoma'
  488.       ParentFont = False
  489.     end
  490.     object lblSystemDate: TLabel
  491.       Left = 589
  492.       Height = 18
  493.       Top = 8
  494.       Width = 80
  495.       AutoSize = False
  496.       Caption = 'lblSystemDate'
  497.       Font.CharSet = ANSI_CHARSET
  498.       Font.Height = -12
  499.       Font.Name = 'Tahoma'
  500.       ParentFont = False
  501.     end
  502.   end
  503. end
  504.  
Code: Pascal  [Select][+][-]
  1. /Volumes/MacHD-SSD-Data/LocBucket/FpLazStuff/PvDebug/PvUploadTest
  2. Heap dump by heaptrc unit of "/Volumes/MacHD-SSD-Data/LocBucket/FpLazStuff/PvDebug/PvUploadTest"
  3. 3959 memory blocks allocated : 2188324/2195024
  4. 3951 memory blocks freed     : 2188054/2194752
  5. 8 unfreed memory blocks : 270
  6. True heap size : 1048576 (96 used in System startup)
  7. True free heap : 1046368
  8. Should be : 1046672
  9. Call trace for block $0000000111AF6E60 size 56
  10.   $000000010C5D69C1 line 438 of cocoa/cocoawinapi.inc
  11.   $000000010C472556 line 125 of include/winapi.inc
  12.   $000000010C462860 line 1168 of include/font.inc
  13.   $000000010C462ECA line 1278 of include/font.inc
  14.   $000000010C463B1D line 249 of include/canvas.inc
  15.   $000000010C4671FF line 1717 of include/canvas.inc
  16.   $000000010C466F2F line 1608 of include/canvas.inc
  17.   $000000010C53D699 line 70 of include/customlabel.inc
  18.   $000000010C53D531 line 41 of include/customlabel.inc
  19.   $000000010C4F1836 line 5613 of include/control.inc
  20.   $000000010C4D6640 line 2788 of include/wincontrol.inc
  21.   $000000010C4D64B6 line 3209 of include/wincontrol.inc
  22.   $000000010C4D6017 line 3289 of include/wincontrol.inc
  23.   $000000010C2DF311 line 102 of include/scrollingwincontrol.inc
  24.   $000000010C4DE110 line 6495 of include/wincontrol.inc
  25.   $000000010C4EA811 line 3096 of include/control.inc
  26. Call trace for block $0000000111AF5900 size 56
  27.   $000000010C5D69C1 line 438 of cocoa/cocoawinapi.inc
  28.   $000000010C472556 line 125 of include/winapi.inc
  29.   $000000010C462860 line 1168 of include/font.inc
  30.   $000000010C462ECA line 1278 of include/font.inc
  31.   $000000010C57E4E1 line 1844 of cocoa/cocoawscommon.pas
  32.   $000000010C4E0C25 line 7691 of include/wincontrol.inc
  33.   $000000010C53B512 line 43 of include/customedit.inc
  34.   $000000010C53AE29 line 115 of include/custommemo.inc
  35.   $000000010C4E0894 line 7605 of include/wincontrol.inc
  36.   $000000010C6E6022 line 662 of richmemo.pas
  37.   $000000010C4DFEA3 line 7489 of include/wincontrol.inc
  38.   $000000010C4E14ED line 7936 of include/wincontrol.inc
  39.   $000000010C4E098B line 7624 of include/wincontrol.inc
  40.   $000000010C2DEF7C line 31 of include/scrollingwincontrol.inc
  41.   $000000010C2E851C line 2733 of include/customform.inc
  42.   $000000010C2E9B16 line 3204 of include/customform.inc
  43. Call trace for block $0000000111ACE200 size 24
  44.   $000000010C62EBDD line 245 of cocoa/cocoacollectionview.pas
  45.   $000000010C593C58
  46.   $000000010C626EB1 line 291 of cocoa/cocoalistview.pas
  47.   $000000010C626E34 line 282 of cocoa/cocoalistview.pas
  48.   $000000010C594D24 line 618 of cocoa/cocoawslistview.pas
  49.   $000000010C509EAC line 584 of include/customlistview.inc
  50.   $000000010C4E0894 line 7605 of include/wincontrol.inc
  51.   $000000010C4DFEA3 line 7489 of include/wincontrol.inc
  52.   $000000010C4E14ED line 7936 of include/wincontrol.inc
  53.   $000000010C4E098B line 7624 of include/wincontrol.inc
  54.   $000000010C2DEF7C line 31 of include/scrollingwincontrol.inc
  55.   $000000010C2E851C line 2733 of include/customform.inc
  56.   $000000010C2E9B16 line 3204 of include/customform.inc
  57.   $000000010C4DFEA3 line 7489 of include/wincontrol.inc
  58.   $000000010C4E14ED line 7936 of include/wincontrol.inc
  59.   $000000010C2F4198 line 2280 of include/application.inc
  60. Call trace for block $0000000111ACFE00 size 23
  61.   $000000010C335B67
  62.   $000000010C335CA4
  63.   $000000010C334769
  64.   $000000010C3338EE
  65.   $000000010C33361E
  66.   $000000010C33399C
  67.   $000000010C3357D2
  68.   $000000010C48BFD9 line 3179 of lresources.pp
  69.   $000000010C483B6A line 805 of lresources.pp
  70.   $000000010C2E6657 line 2034 of include/customform.inc
  71.   $000000010C2E6515 line 2022 of include/customform.inc
  72.   $000000010C2E9BD7 line 3216 of include/customform.inc
  73.   $000000010C2F4159 line 2273 of include/application.inc
  74.   $000000010C2AF9CE line 21 of PvUploadTest.lpr
  75.   $000000010C2D305C
  76.   $00000001154B252E
  77. Call trace for block $0000000111ACBC00 size 23
  78.   $000000010C335B67
  79.   $000000010C335CA4
  80.   $000000010C334769
  81.   $000000010C3338EE
  82.   $000000010C33361E
  83.   $000000010C33399C
  84.   $000000010C3357D2
  85.   $000000010C48BFD9 line 3179 of lresources.pp
  86.   $000000010C483B6A line 805 of lresources.pp
  87.   $000000010C2E6657 line 2034 of include/customform.inc
  88.   $000000010C2E6515 line 2022 of include/customform.inc
  89.   $000000010C2E9BD7 line 3216 of include/customform.inc
  90.   $000000010C2F4159 line 2273 of include/application.inc
  91.   $000000010C2AF9CE line 21 of PvUploadTest.lpr
  92.   $000000010C2D305C
  93.   $00000001154B252E
  94. Call trace for block $000000010D72A000 size 32
  95.   $000000010C2C736E
  96.   $000000010C2D305C
  97.   $00000001154B252E
  98. Call trace for block $000000010D729F00 size 32
  99.   $000000010C2C736E
  100.   $000000010C2D305C
  101.   $00000001154B252E
  102. Call trace for block $000000010D729B00 size 24
  103.   $000000010C5DF9D2 line 375 of cocoa/cocoaconfig.pas
  104.   $000000010C2C736E
  105.   $000000010C2D305C
  106.   $00000001154B252E

Code: Pascal  [Select][+][-]
  1. program PvUploadTest;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}
  7.   cthreads,
  8.   {$ENDIF}
  9.   {$IFDEF HASAMIGA}
  10.   athreads,
  11.   {$ENDIF}
  12.   Interfaces, // this includes the LCL widgetset
  13.   Forms, anchordockpkg, lazcontrols, U_frmAuroraDataUpload;
  14.  
  15. {$R *.res}
  16.  
  17. begin
  18.   RequireDerivedFormResource:=True;
  19.   Application.Scaled:=True;
  20.   Application.Initialize;
  21.   Application.CreateForm(TfrmAuroraDataUpload, frmAuroraDataUpload);
  22.   Application.Run;
  23. end.

Code: Pascal  [Select][+][-]
  1. unit U_frmAuroraDataUpload;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
  9.   ComCtrls, ExtCtrls,
  10.   LCLType, RichMemo;
  11.  
  12. type
  13.  
  14.   { TfrmAuroraDataUpload }
  15.  
  16.   TfrmAuroraDataUpload = class(TForm)
  17.   Button1: TButton;
  18.   Button7: TButton;
  19.   Button8: TButton;
  20.   Label18: TLabel;
  21.   Label3: TLabel;
  22.   Label4: TLabel;
  23.   Label5: TLabel;
  24.   lblCurDate: TLabel;
  25.   lblInvModel: TLabel;
  26.   lblSystemDate: TLabel;
  27.   lblSystemName: TLabel;
  28.   lblTitle: TLabel;
  29.   lblVer: TLabel;
  30.   Panel1: TPanel;
  31.   Panel2: TPanel;
  32.   RmPvUploadLog: TRichMemo;
  33.   RmFileScanLog: TRichMemo;
  34.   RmPvUploadError: TRichMemo;
  35.   RmFileScanError: TRichMemo;
  36.   RmUploadDays: TRichMemo;
  37.   RmLoggedDays: TRichMemo;
  38.  
  39.     cmdSettings: TButton;
  40.     Button2: TButton;
  41.     Button3: TButton;
  42.     cmdStart: TButton;
  43.     cmdStop: TButton;
  44.     cmdfrmAuroraExit: TButton;
  45.     Label10: TLabel;
  46.     Label11: TLabel;
  47.     Label12: TLabel;
  48.     Label13: TLabel;
  49.     lblFileScan: TLabel;
  50.     lblPvUpload: TLabel;
  51.     Label16: TLabel;
  52.     Label17: TLabel;
  53.     Label7: TLabel;
  54.     ListView1: TListView;
  55.  
  56.     procedure Button1Click(Sender: TObject);
  57.     procedure cmdSettingsClick(Sender: TObject);
  58.     procedure cmdStartClick(Sender: TObject);
  59.     procedure cmdStopClick(Sender: TObject);
  60.     procedure cmdfrmAuroraExitClick(Sender: TObject);
  61.  
  62.  
  63. Private
  64.  
  65. Public
  66.  
  67. End;
  68.  
  69. Var
  70.   frmAuroraDataUpload: TfrmAuroraDataUpload;
  71.  
  72. Implementation
  73.  
  74. {$R *.lfm}
  75.  
  76. Procedure TfrmAuroraDataUpload.cmdSettingsClick(Sender: TObject);
  77. Begin
  78. End;{Procedure cmdSettingsClick}
  79. procedure TfrmAuroraDataUpload.Button1Click(Sender: TObject);
  80. Begin
  81. end;
  82. Procedure TfrmAuroraDataUpload.cmdStartClick(Sender: TObject);
  83. Begin
  84. End;
  85. procedure TfrmAuroraDataUpload.cmdStopClick(Sender: TObject);
  86. begin
  87. end;
  88. Procedure TfrmAuroraDataUpload.cmdfrmAuroraExitClick(Sender: TObject);
  89. begin
  90. ShowMessage('About to close');
  91. Close;
  92. End;{Procedure cmdfrmAuroraExitClick}
  93.  
  94. End.
  95.  
MacBook Pro mid 2015 with OS Monterey 12.7.6
FPC 3.3.1 Lazarus 3.99
FPC 3.2.2 Lazarus 3.4

jamie

  • Hero Member
  • *****
  • Posts: 6690
Re: Memory leak in form with no code
« Reply #1 on: September 07, 2024, 11:06:03 pm »
Time to upgrade, I see you are on 3.0, its 3.4 now
The only true wisdom is knowing you know nothing

Wilko500

  • Full Member
  • ***
  • Posts: 101
Re: Memory leak in form with no code
« Reply #2 on: September 07, 2024, 11:27:07 pm »
I do have 3.4 running but could not get heaptrc line numbers with it (the FPCUpDeluxe version).  Thus I used 3.99 which does provide the required line numbers.  When I have time I need to try again with 3.4.  Thank you for reminding me to update my profile
MacBook Pro mid 2015 with OS Monterey 12.7.6
FPC 3.3.1 Lazarus 3.99
FPC 3.2.2 Lazarus 3.4

jamie

  • Hero Member
  • *****
  • Posts: 6690
Re: Memory leak in form with no code
« Reply #3 on: September 07, 2024, 11:31:39 pm »
Did you try a simple blank form?
IF that is ok, then it could be one of the controls you have on the form.
The only true wisdom is knowing you know nothing

Wilko500

  • Full Member
  • ***
  • Posts: 101
Re: Memory leak in form with no code
« Reply #4 on: September 07, 2024, 11:40:41 pm »
Yes.  I did two tests.  The first was a simple form with just an exit button. No leaks.  Second, I took the form shown in this post and removed controls one at a time starting from the bottom working upwards.  Only when I was down to two of the labels at the top did I get a no leak condition.  However even that was not consistent. When I tried to repeat that test a few more times the leak returned. Didn't matter which label was left/removed.
So yes, I think it is one of the controls but why?
MacBook Pro mid 2015 with OS Monterey 12.7.6
FPC 3.3.1 Lazarus 3.99
FPC 3.2.2 Lazarus 3.4

Wilko500

  • Full Member
  • ***
  • Posts: 101
Re: Memory leak in form with no code
« Reply #5 on: September 07, 2024, 11:57:57 pm »
With this form pruned down 3 unfreed blocks.  Take the command button off then still 3 unfree blocks

Code: Pascal  [Select][+][-]
  1. /Volumes/MacHD-SSD-Data/LocBucket/FpLazStuff/PvDebug/PvUploadTest
  2. Heap dump by heaptrc unit of "/Volumes/MacHD-SSD-Data/LocBucket/FpLazStuff/PvDebug/PvUploadTest"
  3. 857 memory blocks allocated : 1943702/1944592
  4. 854 memory blocks freed     : 1943614/1944504
  5. 3 unfreed memory blocks : 88
  6. True heap size : 917504 (96 used in System startup)
  7. True free heap : 916640
  8. Should be : 916744
  9. Call trace for block $000000010FD28000 size 32
  10.   $000000010E8F15FE
  11.   $000000010E8FD2EC
  12.   $000000011F4A452E
  13. Call trace for block $000000010FD27F00 size 32
  14.   $000000010E8F15FE
  15.   $000000010E8FD2EC
  16.   $000000011F4A452E
  17. Call trace for block $000000010FD27B00 size 24
  18.   $000000010EC09B92 line 375 of cocoa/cocoaconfig.pas
  19.   $000000010E8F15FE
  20.   $000000010E8FD2EC
  21.   $000000011F4A452E
MacBook Pro mid 2015 with OS Monterey 12.7.6
FPC 3.3.1 Lazarus 3.99
FPC 3.2.2 Lazarus 3.4

 

TinyPortal © 2005-2018