HEAPTRACK(1)

✨ NAME ✨

okay so heaptrack is a heap memory profiler for linux, and this one is the command line utility version of it. that's the whole vibe, no cap. 🫢

also hiii, you're on the heaptrack(1) page β€” section one, User Commands, the iconic one. πŸ’…


🌸 SYNOPSIS 🌸

like, here's how you actually run it:

heaptrack [--debug|-d] DEBUGGEE [ARGUMENT]...
heaptrack [--debug|-d] -p PID

πŸŽ€ DESCRIPTION πŸŽ€

bestie. listen. it's a heap memory usage profiler. the way it works is it uses LD_PRELOAD to track literally every single call to the core memory allocation functions, and it logs all of those occurrences. πŸ“

on top of that, backtraces get obtained and logged too. put those two things together and suddenly you have interesting answers to questions like:

  • How much heap memory is my application using?
  • Where is heap memory being allocated, and how often?
  • How much space are heap individual allocations requesting?

then, to actually go evaluate the heaptrack data you generated, you reach for heaptrack_print or heaptrack_gui. that's the duo. πŸ‘‘

πŸ’– Mandatory arguments to heaptrack πŸ’–

  • DEBUGGEE β€” the name or the path to the application that should be run with heaptrack analyzation enabled. you need this one, it's not optional, periodt.

πŸ¦‹ Alternatively, to attach to a running process πŸ¦‹

  • -p, --pid PID β€” the process ID of a running process that heaptrack will get injected into. important caveat bestie: this only works with applications that already link against libdl. so check that first, don't come crying to me. 😭

🌈 Optional arguments to heaptrack 🌈

  • -d, --debug β€” runs the debuggee inside GDB and heaptrack. double the chaos, double the fun. πŸ”₯
  • ARGUMENT β€” any number of arguments, and they get passed verbatim to the debuggee. exactly as you typed them, no edits, no notes.
  • -h, --help β€” shows this help message and then exits. classic. πŸ’…
  • -v, --version β€” displays version information. the "which build am i even on" button. ⭐

πŸ’œ SEE ALSO πŸ’œ

the full documentation for heaptrack is maintained as a Texinfo manual. so if the info and heaptrack programs are properly installed at your site, then this command:

info heaptrack

should give you access to the complete manual. go off, read the whole thing. πŸ“šβœ¨


and that's a wrap on the heaptrack(1) page, bestie β€” this was heaptrack 1.0.0, from March 2017, brought to you by the User Commands section. ty for coming to my ted talk, mwah πŸŽ€πŸ’–πŸ¦‹