How to properly free records that contain various types in Delphi at once?

Assuming you have a Delphi version that supports implementing methods on a record, you could clear a record like this: type TSomeRecord = record field1: integer; field2: string; field3: boolean; procedure Clear; end; procedure TSomeRecord.Clear; begin Self := Default(TSomeRecord); end; If your compiler doesn’t support Default then you can do the same quite simply like … Read more