Hasty Briefsbeta

Bilingual

Go Allocation Probe

9 months ago
  • #profiling
  • #memory-allocation
  • #Go
  • Go profiling tools show allocation locations but not types.
  • A custom tool, go_allocation_probe, was created to track allocations by type using bpftrace.
  • The tool attaches to mallocgc in Go to capture size and type arguments.
  • Type names are resolved using offsets in the executable's data sections.
  • Some allocations pass nil as the type pointer, requiring additional probes.
  • The tool helped identify frequent allocations of *string types.
  • The solution involves fragile but effective code to map type pointers to names.