Bug 452800

Summary: Ability to set manual snapshots from signal
Product: [Applications] Heaptrack Reporter: Guillaume Desmottes <gdesmott>
Component: generalAssignee: Milian Wolff <mail>
Status: REPORTED ---    
Severity: wishlist CC: gdesmott
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Guillaume Desmottes 2022-04-20 14:35:42 UTC
The DATA segment of my application keeps growing when I do some tasks. Ideally I'd like to be able to do something like this to help me debug it:

- Send a signal (such as `SIGUSR1`) to trigger a snapshot from heaptrack.
- Interact with my app to reproduce the problem.
- Send another signal to trigger a second snapshot.
- Be able somehow to see the memory which have been allocated (and not freed) between these two snapshots.

Does this make sense?

I implemented something similar in GStreamer's leaks tracer (see https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/main/subprojects/gstreamer/plugins/tracers/gstleaks.c#L810 ) and it's been quite useful.
Comment 1 Milian Wolff 2022-04-20 21:50:11 UTC
heaptrack now allows filtering on the time axis of the charts. I think adding custom markers there to better allow figuring out where to filter is a great idea! I'm not so fond though of writing to different files or such to create different snapshots.

patches welcome :)
Comment 2 Guillaume Desmottes 2022-04-21 08:25:21 UTC
> heaptrack now allows filtering on the time axis of the charts.

So is there a way to filter to only display the allocated and not freed memory in a specific time interval?
I didn't find any way to do that in heaptrack_gui.

> I think adding custom markers there to better allow figuring out where to filter is a great idea! I'm not so fond though of writing to different files or such to create different snapshots.

Agreed, I think custom markers would be enough then.
Comment 3 Milian Wolff 2022-04-22 13:44:15 UTC
See https://www.kdab.com/heaptrack-v1-3-0-release/ that shows a screenshot with the filtering active.

The range basically selects two time slices and when you apply that filter, the tables and flamegraph will show the delta between those two time slices.