← All notes

Go runtime/debug: debugging helpers for Go programs

Answer: Package debug contains facilities for programs to debug themselves while they are running.

Build information and stacks

ReadBuildInfo reports build information embedded in the running binary.

Stack returns a formatted stack trace of the calling goroutine.

SetCrashOutput can send additional crash output to a chosen file.

Garbage collection controls

SetGCPercent sets the garbage collection target percentage.

FreeOSMemory runs a collection and returns unused memory to the operating system.

ReadGCStats fills a GCStats value with recent garbage collection data, including pause history.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Go Authors, runtime/debug; The Go Authors, runtime/debug source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: The Go Authors, runtime/debug; The Go Authors, runtime/debug source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.

Cite this

Permanent ID: iil:note:ypzfe4q3

iinventedlight. 2026. "Go runtime/debug: debugging helpers for Go programs." iinventedlight Library, iil:note:ypzfe4q3, version of 2026-11-24. https://iinventedlight.com/library/notes/go-rtdebug/. License: CC-BY-4.0.

@misc{iil_note_ypzfe4q3,
  author = {{iinventedlight}},
  title = {{Go runtime/debug: debugging helpers for Go programs}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-24},
  url = {https://iinventedlight.com/library/notes/go-rtdebug/},
  note = {Permanent ID iil:note:ypzfe4q3. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-rtdebug.md.