Skip to content
프로젝트

소개

Go 힙 객체 참조를 분석하는 도구입니다.

개발 도구

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
+1
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Goref

English | 中文

WebSite License

Goref is a Go heap object reference analysis tool based on delve.

It can display the space and object count distribution of Go memory references, which is helpful for efficiently locating memory leak issues or viewing persistent heap objects to optimize the garbage collector (GC) overhead.

Installation

$ go install github.com/cloudwego/goref/cmd/grf@latest

Usage

Attach to a running process with its PID, and then use go pprof tool to open the output file.

$ grf attach ${PID}
successfully output to `grf.out`
$ go tool pprof -http=:5079 ./grf.out

Please be aware that grf attach will suspend the program until the command exits.

The opened HTML page displays the reference distribution of the heap memory. You can choose to view the "inuse space" or "inuse objects".

For example, the heap profile sampled from a testing program is shown below, which reflects the call stack distribution of object creation.

img_v3_02gq_63631612-6f2d-40ce-8f98-a4e52682ef7g

By using the goref tool, you can see the memory reference distribution of heap objects reachable by GC, thereby quickly pinpointing the actual code locations holding references.

img_v3_02gq_53dc2cff-203a-4c06-9678-aae49da4754g

img_v3_02gq_54551396-a4ae-42b8-996f-1b1699d381dg

It also supports analyzing core files, e.g.

$ grf core ${execfile} ${corefile}
successfully output to `grf.out`

Go Version Constraints

  • Executable file: go1.19 ~ go1.26
  • Compile goref tool: >= go1.21

Docs

How it Works | Advanced Usage

Credit

Thanks to Delve for providing powerful golang debugger.

관련 프로젝트 살펴보기

불러오는 중…