Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2025-10

heap trace with line info on macOS

6 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

Hi.

I can enable heap trace and line info as usual with the -gh and -gl command line parameters - to report any memory leaks in my application. But no matter what I try, I get the memory leak dump, but always without line information.

Is this not a supported feature on macOS?

Regards,
Graeme

Jonas Maebe
to Unknown author
mailinglists--- wrote 8 lines
Hi. I can enable heap trace and line info as usual with the -gh and -gl command line parameters - to report any memory leaks in my application. But no matter what I try, I get the memory leak dump, but always without line information. Is this not a supported feature on macOS?

It should work on trunk if you also compile with -Xg

Jonas

Martin Frb
to Jonas Maebe
Jonas Maebe wrote 12 lines
On 15/10/2025 11:15, mailinglists--- via fpc-pascal wrote: > Hi. > > I can enable heap trace and line info as usual with the -gh and -gl > command line parameters - to report any memory leaks in my > application. But no matter what I try, I get the memory leak dump, > but always without line information. > > Is this not a supported feature on macOS? It should work on trunk if you also compile with -Xg

If you don't have/want trunk, but are able to use the Lazarus IDE, there is a feature "Leaks and traces" (in the view menu) (requires package "leakview", but installed by default).
This has a "resolve" button. If you paste the trace (address only), press resolve, and select the exe then it should translate the addresses.

It should work on Mac too / Though I haven't tested it in ages. (If it doesn't / apologies for the noise)
Not sure if you need to select the app bundle, or the exe inside the app bundle.

Peter B
to Unknown author: Hi. I can enable heap trace and line info as usual with the -gh and -gl command line…
mailinglists--- wrote 11 lines
Hi. I can enable heap trace and line info as usual with the -gh and -gl command line parameters - to report any memory leaks in my application. But no matter what I try, I get the memory leak dump, but always without line information. Is this not a supported feature on macOS? Regards,   Graeme _______________________________________________ fpc-pascal maillist  -  https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Just a thought in this.

If the problem is arising in the RTL or LCL, there will not be line information unless those parts are also compiled with -gl etc.

If GTK2 is involved, the --sync option might be needed.

Cheers,
Peter

Unknown author
to Peter B
Peter B wrote
If the problem is arising in the RTL or LCL,

It was code in my fpGUI framework and my application. All the code is compiled
with -gl -gh -gw -O- etc

I eventually used the 'atos' tool to resolve one or two of the top addresses, which
gave me some hints. But that slowed me down massively.

Usage:

atos -o YourExecutable <AddressToResolve>

I'll try the development version of FPC, as Jonas mention, and see how that fairs. 🤞

Regards,
- Graeme -

Unknown author
to Martin Frb: If you don't have/want trunk, but are able to use the Lazarus IDE, there is a feature…
Martin Frb wrote
If you don't have/want trunk, but are able to use the Lazarus IDE, there is a feature "Leaks and traces" (in the view menu)

Thanks Martin. Good to know there are alternative options. I wasn't using
Lazarus IDE at the time, but don't mind install it going forward.

In the end I used 'atos' from the command line (seems included with macOS by
default), which did similar to what you describe, but it was slow/manual process.

Usage: atos -o YourExecutable <AddressToResolve>

Regards,
- Graeme -