Best if you attach the sample project with lpi, so we have all the settings.
Reading your description, I would have expected to see file names and line numbers on the trace (no need to recompile the RTL / it should show your file)
That is, only the first line should have a filename and line, showing your "getmem" call.
Since it is in the main program body the calling frames are fpc generated stuff...
Sometimes heaptrc ( -gh ) has a problem. actually the line dumper ( -gl ) has.
Then you can try to paste the output with the numbers, into the IDE' leakview (tools menu), and press the resolve button and select your exe.
You may also try -gs instead of -gw
I remember, I had issues with -gw together with -gh in some versions of fpc. But not sure which.