HEAPTRACK_PRINT(1)

πŸ’– NAME πŸ’–

heaptrack_print β€” the heap memory profiler for linux's print utility, bestie edition 🫢


✨ DESCRIPTION ✨

Okay so, heaptrack_print is here to analyze heaptrack data files. That's the whole job. Iconic, focused, no notes. πŸ’…

And like, real quick, what even is heaptrack? It's a heap memory profiler that records the tea β˜• on every single call to heap allocation functions β€” we're talking malloc, operator new, etc. pp. β€” and it writes all of that into data files. Then this print utility shows up to read those files and tell you what's actually going on. It's giving detective. It's giving forensic accountant for your RAM. πŸ”βœ¨


πŸŽ€ OPTIONS πŸŽ€

  • -f [ --file ] arg β€” The heaptrack data file you wanna print. The main character file, fr. πŸ“„
  • -d [ --diff ] arg β€” Find the differences compared to this file. Side-by-side slay. πŸ”₯
  • -t [ --shorten-templates ] [=arg(=1)] (=1) β€” Shorten template identifiers. Cute, compact, lowkey easier to read. ✨
  • -m [ --merge-backtraces ] [=arg(=1)] (=1) β€” Merge backtraces. > ⚠️ NOTE: the merged peak consumption is not correct. Just so you know. Not me warning you twice. 😭
  • -p [ --print-peaks ] [=arg(=1)] (=1) β€” Print backtraces to top allocators, sorted by peak consumption. The heavy hitters, the main characters. πŸ‘‘
  • -a [ --print-allocators ] [=arg(=1)] (=1) β€” Print backtraces to top allocators, sorted by number of calls to allocation functions. Who's being called the most, basically the group chat spammer. πŸ“ž
  • -T [ --print-temporary ] [=arg(=1)] (=1) β€” Print backtraces to top allocators, sorted by number of temporary allocations. The fleeting ones, the "we were never official" allocations. πŸ¦‹
  • -l [ --print-leaks ] [=arg(=1)] (=0) β€” Print backtraces to leaked memory allocations. The ones that never left the party. 🫠
  • -o [ --print-overall-allocated ] [=arg(=1)] (=0) β€” Print top overall allocators, ignoring memory frees. We're not counting the goodbyes, only the hellos. πŸ™ˆ
  • -n [ --peak-limit ] [=arg(=10)] (=10) β€” Limit the number of reported peaks. Default is 10. Keep it tidy bestie. πŸ”’
  • -s [ --sub-peak-limit ] [=arg(=5)] (=5) β€” Limit the number of reported backtraces of merged peak locations. Default is 5. 🌸
  • -H [ --print-histogram ] arg β€” Path to output file where an allocation size histogram will be written to. Data visualization moment. πŸ“Š
  • -F [ --print-flamegraph ] arg β€” Path to output file where a flame-graph compatible stack file will be written to. To visualize the resulting file, use flamegraph.pl from https://github.com/brendangregg/FlameGraph:
heaptrack_print heaptrack.someapp.PID.gz -F stacks.txt
# optionally pass --reverse to flamegraph.pl
flamegraph.pl --title "heaptrack: allocations" --colors mem \
--countname allocations < stacks.txt > heaptrack.someapp.PID.svg
[firefox|chromium] heaptrack.someapp.PID.svg

✨ Look at that pipeline. We love a little output-to-SVG glow-up. 🌈

  • -M [ --print-massif ] arg β€” Path to output file where a massif compatible data file will be written to. πŸ“
  • --massif-threshold arg (=1) β€” Percentage of current memory usage, below which allocations are aggregated into a 'below threshold' entry. This is only used in the massif output file so far. Default is 1. 🎚️
  • --massif-detailed-freq arg (=2) β€” Frequency of detailed snapshots in the massif output file. Increase this to reduce the file size. You can set the value to zero to disable detailed snapshots. Default is 2. πŸ“Έ
  • --filter-bt-function arg β€” Only print allocations where the backtrace contains the given function. A little laser focus, a little filter, as a treat. πŸ”¦
  • -h [ --help ] β€” Show this help message. Bestie behaviour, always there for you. 🫢
  • -v [ --version ] β€” Displays version information. The lore drop. ⭐

🌟 SEE ALSO 🌟

So the full documentation for heaptrack_print is maintained as a Texinfo manual. And if the info and heaptrack_print programs are properly installed at your site, then this command right here:

info heaptrack_print

should give you access to the complete manual. Go read it, it's giving reference material, it's giving ✨knowledge✨. πŸ’œ


And that's the whole page, bestie!! This was heaptrack_print 1.0.0, dated March 2017 β€” literally an icon, an OG, a legend from the manual archives. πŸŽ€βœ¨ No cap, that's the version and the date, right there in the footer where the history lives. Take care of your heap and it'll take care of you. πŸ’–πŸ¦‹