Simple continuous memory info aggregator from GoLang gc trace
A single cycle of GC Trace looks like:
gc 3 @3.182s 0%: 0.015+0.59+0.096 ms clock, 0.19+0.10/1.3/3.0+1.1 ms cpu, 4->4->2 MB, 5 MB goal, 12 PThis line is printed every time the Go garbage collector runs and shows detailed metrics about that specific GC cycle.
Installation:
go install github.com/kunalsin9h/memgc@latestUsage:
GODEBUG=gctrace=1 ./bin 2> >(memgc --csv data.csv)This will output a data.csv file.
Load the data.csv file in graph plotting tools like Draxlr
Shows "Total percentage of CPU time spent in GC since the program started"
If this number keeps increasing, it means GC overhead is increasing - possibly due to memory leaks or excessive allocations.
Tells how much heap memory in use before that GC cycle.
Live Heap = Memory that is actually reachable and in use by your program after GC completes.
If this value is keeping increasing and not degreasing (i.e next GC cycle is not cleaning it) that means we have memory leak