If I announce
PSomeStruct = ^TSomeStruct; TSomeStruct = record s1 : string; end;
and I run the following code:
var p: PSomeStruct; begin new(p); p^.s1:= 'something bla bla bla'; dispose(p);
The FastMM 4 memory manager reports that a memory leak has occurred (type: string, data dump: "something bla bla bla"). However, if I set the string s1 to empty before calling dispose , that's OK.
The second way I found is to switch from a record type to a class, and instead of new create an instance, and instead of dispose I call instance.Free() . It works without manually clearing strings.
Is there a way to get Delphi to automatically clear my lines when dispose called?
source share