@Pascal,
Thanks for the suggestion, but it does not help. I think this is the minimal project:
program leak;
uses
Classes;
var
PascalFiles: TStringList;
begin
PascalFiles := TStringList.Create;
end.
On MacOS if I compile with
$ fpc -g -gl -gh -O- -gh leak.pas
I get
$ ./leak
Heap dump by heaptrc unit
22 memory blocks allocated : 2176/2176
21 memory blocks freed : 2056/2056
1 unfreed memory blocks : 120
True heap size : 655360 (32 used in System startup)
True free heap : 655040
Should be : 655080
Call trace for block $00000001001EE300 size 120
The [leakview][http://wiki.freepascal.org/leakview] does not show anything more.
This [2017 stackoverflow][https://stackoverflow.com/questions/47660310/unable-to-generate-line-numbers-in-fpc-debugging-output] question also suggests heaptrc does not provide line numbers with MacOS. One of the commenters suggests if requires ppc32 architecture on macOS. I guess this might refer to PowerPC, as targeting either 32-bit i386 or 64-bit x86_64 had no influence.