Jump to content

Search the Community

Showing results for tags 'memoryleak'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start




Found 1 result

  1. Delphi 10.4.1 Windows 10 Why does this leak memory? FastMM4 reports A memory block has been leaked. The size is: 36 This block was allocated by thread 0x948, and the stack trace (return addresses) at the time was: 4070A2 [System.pas][System][@GetMem$qqri][4843] 40A0F7 [System.pas][System][@NewUnicodeString$qqri][25659] 40A584 [System.pas][System][@UStrAsg$qqrr20System.UnicodeStringx20System.UnicodeString][26643] 615C6A [Unit1.pas][Unit1][TForm1.GetReminder][65] 616166 [Unit1][Generics.Collections.%TList__1$19Unit1.TReminderItem%.Create] 615A34 [Unit1.pas][Unit1][TForm1.Button1Click][46] 770168CF [GetWindowLongW] 720A55DC [Unknown function at SetWindowSubclass] 4086D3 [System.pas][System][@IsClass$qqrxp14System.TObjectp17System.TMetaClass][18453] 553531 [Vcl.Controls.pas][Vcl.Controls][Controls.TControl.Click][7596] 56C28B [Vcl.StdCtrls.pas][Vcl.StdCtrls][Stdctrls.TCustomButton.Click][5609] type TReminderItem = record public RecordID: Integer; EmployeeID: Integer; EmployeeName: String; HireDate: TDate; LastDate: TDate; Notes: String; procedure Clear; end; TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private procedure GetReminder(AList: TList<TReminderItem>); end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var LList : TList<TReminderItem>; LReminderItem : TReminderItem; PReminderItem : ^TReminderItem; begin LList := TList<TReminderItem>.Create; try GetReminder(LList); ShowMessage(LList[0].EmployeeName); finally for LReminderItem in LList do LReminderItem.Clear; LList.Free; end; end; procedure TForm1.GetReminder(AList :TList<TReminderItem>); var LReminderItem: ^TReminderItem; begin New(LReminderItem); LReminderItem.RecordID := 1; LReminderItem.EmployeeID := 1; LReminderItem.EmployeeName := 'Test'; LReminderItem.HireDate := Now; LReminderItem.LastDate := Now;; LReminderItem.Notes := 'A Note'; AList.Add(LReminderItem^); end; { TReminderItem } procedure TReminderItem.Clear; begin Self := Default(TReminderItem); end; This is just my latest attempt, I have tried Finalize, FinalizeRecord, FreeMem. The Clear procedure is also an attempt after seeing it in a different post. What is the proper way to free memory of a record I create in a list? Thanks in advance, Gary Unit1.pas Unit1.dfm