Skip to content

KunalSin9h/memgc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

memgc

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 P

This line is printed every time the Go garbage collector runs and shows detailed metrics about that specific GC cycle.

Data Aggregation

Installation:

go install github.com/kunalsin9h/memgc@latest

Usage:

GODEBUG=gctrace=1 ./bin 2> >(memgc --csv data.csv)

This will output a data.csv file.

Visualization

Load the data.csv file in graph plotting tools like Draxlr

CPUPercent

Shows "Total percentage of CPU time spent in GC since the program started"

image

If this number keeps increasing, it means GC overhead is increasing - possibly due to memory leaks or excessive allocations.

HeapInUseBefore

Tells how much heap memory in use before that GC cycle.

image

HeapMarkedLive

Live Heap = Memory that is actually reachable and in use by your program after GC completes.

image

If this value is keeping increasing and not degreasing (i.e next GC cycle is not cleaning it) that means we have memory leak

Reference

About

Simple continuous memory info aggregator from GoLang `gc trace`

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages