This output will show you the "reference tree," pointing back to the root (e.g., a global map or a running goroutine) that prevents the garbage collector from freeing the memory. 2. Analyzing Goroutine Leaks
To extract human-readable ASCII and UTF-8 strings (similar to the Linux strings utility but multi-threaded):
Often, memory leaks are actually goroutine leaks. If a goroutine is blocked, all memory it references is leaked. xdumpgo goroutines heap.dump Use code with caution. xdumpgo tutorial extra quality
After dumping, run:
func main() a := 1 dump.Dump(a) // Uses default instance This output will show you the "reference tree,"
: By default, xdump will look for related objects. This "extra quality" step ensures that if a record in your table depends on a record in , both are included in the dump. Execute and Load
# Dump only users and orders xdumpgo -d e_commerce_db --include="users,orders" # Dump everything EXCEPT sessions xdumpgo -d e_commerce_db --exclude="sessions" Use code with caution. Handling Large Blobs If a goroutine is blocked, all memory it
XDumpGO relies on a JSON configuration file to define the dump parameters. A standard configuration looks like this:
Focus only on the tables and fields defined in the audit plan.
: Streams data without overloading system RAM.
Depending on the version of XDumpGO, you may need a runtime environment installed.