Recent

Author Topic: Unreadable heaptrace on aarch64  (Read 1866 times)

apeoperaio

  • Sr. Member
  • ****
  • Posts: 281
Unreadable heaptrace on aarch64
« on: April 03, 2023, 09:41:52 am »
I am doing some tests with one of my app on aarch64 (macOS M2 processor).
While on win, linux and macOS x86_64 I have no issues, on macOS aarch64 I got some unfreed memory blocks.

I saved the heaptrace log to a file but it is quite useless, since it does not include any understandable information (see attached file). Apart from the summary information I cannot find info about lines related to the memory leaks.

Is there a way to get more readable info?

dbannon

  • Hero Member
  • *****
  • Posts: 3189
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Unreadable heaptrace on aarch64
« Reply #1 on: April 03, 2023, 12:14:48 pm »
You did compile with debug info turned on ?

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

apeoperaio

  • Sr. Member
  • ****
  • Posts: 281
Re: Unreadable heaptrace on aarch64
« Reply #2 on: April 03, 2023, 02:12:33 pm »
I suppose that the debug info is turned on, see attached image.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10668
  • Debugger - SynEdit - and more
    • wiki
Re: Unreadable heaptrace on aarch64
« Reply #3 on: April 03, 2023, 04:05:54 pm »
IIRC it may not be implemented for Mac (I remember at some point back, it wasn't for Mac Intel (not sure Darwin or Cocoa... But I think only "stabs" was supported, and afaik "stabs" can no longer be used), and it is quite possible that includes Mac M2).

If your exe was compiled with debug info, then you can try, to copy the trace (with only the addresses) into
IDE Menu: View > Leaks and Traces

Then in that window, press "resolve" and open the exe. (not sure, either the bundle, or the actual exe inside it).

LLDB (and/or gdb) should also be able to take the exe, and resolve addresses. But that is a fair amount of work, and you need to google it.

apeoperaio

  • Sr. Member
  • ****
  • Posts: 281
Re: Unreadable heaptrace on aarch64
« Reply #4 on: April 03, 2023, 05:50:04 pm »
Thank you @Martin_fr.

Now the heaptrace is more readable.

I found a first memory leak just executing a TOpenDialog, I suppose it is not the only one.

I attached a sample project to test it. Should I start a new thread?


-------------
Lazarus 2.2.7 (rev lazarus_2_2_6-1-gada7a90f86) FPC 3.2.2 aarch64-darwin-cocoa

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10668
  • Debugger - SynEdit - and more
    • wiki
Re: Unreadable heaptrace on aarch64
« Reply #5 on: April 03, 2023, 06:46:07 pm »
I don't have a Mac to test it. So I can't comment on it.

It needs to be found if it is in your code, or in OpenDlg....

apeoperaio

  • Sr. Member
  • ****
  • Posts: 281
Re: Unreadable heaptrace on aarch64
« Reply #6 on: April 04, 2023, 07:57:09 am »
I am quite sure that there are some issues when dealing with the TOpenDialog, specifically if I set the the Filter property.
In the previous post I attached a very simple project.
The memory leak appears if I set the Filter property.

Should I open a bug report?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10668
  • Debugger - SynEdit - and more
    • wiki
Re: Unreadable heaptrace on aarch64
« Reply #7 on: April 04, 2023, 08:44:42 am »
If in doubt probably yes.

apeoperaio

  • Sr. Member
  • ****
  • Posts: 281
Re: Unreadable heaptrace on aarch64
« Reply #8 on: April 04, 2023, 09:08:26 am »
Ok, added the bugreport here:
https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40192

Since the issue appears when using cocoa I also opened a new thread here:
https://forum.lazarus.freepascal.org/index.php?topic=62940.0

apeoperaio

  • Sr. Member
  • ****
  • Posts: 281
Re: Unreadable heaptrace on aarch64
« Reply #9 on: April 04, 2023, 03:56:39 pm »
I updated the bug tracker since I checked with x86_64 as target, and I got the same memory leak as for aarch64

apeoperaio

  • Sr. Member
  • ****
  • Posts: 281
Re: Unreadable heaptrace on aarch64
« Reply #10 on: June 12, 2023, 01:21:53 pm »
The bug is fixed, tested on macOS Ventura, both x86_64 and aarch64.

 

TinyPortal © 2005-2018