{"id":14079483,"url":"https://github.com/cloudwego/goref","last_synced_at":"2025-05-15T08:11:04.235Z","repository":{"id":247710493,"uuid":"826598235","full_name":"cloudwego/goref","owner":"cloudwego","description":"Go heap object reference analysis tool","archived":false,"fork":false,"pushed_at":"2025-04-22T09:19:11.000Z","size":106,"stargazers_count":822,"open_issues_count":2,"forks_count":29,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-04-22T10:37:30.180Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudwego.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-10T02:53:01.000Z","updated_at":"2025-04-22T10:11:20.000Z","dependencies_parsed_at":"2024-07-29T16:38:48.974Z","dependency_job_id":"4ca6e64c-f01d-4738-be82-4290f4b975e2","html_url":"https://github.com/cloudwego/goref","commit_stats":{"total_commits":18,"total_committers":3,"mean_commits":6.0,"dds":"0.16666666666666663","last_synced_commit":"770b82cf03ec920ccfba1f644c573ebcb48c25a4"},"previous_names":["cloudwego/goref"],"tags_count":3,"template":false,"template_full_name":"cloudwego/.github","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudwego%2Fgoref","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudwego%2Fgoref/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudwego%2Fgoref/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudwego%2Fgoref/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudwego","download_url":"https://codeload.github.com/cloudwego/goref/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254301432,"owners_count":22047904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-13T12:00:58.512Z","updated_at":"2025-05-15T08:11:04.218Z","avatar_url":"https://github.com/cloudwego.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Goref\n\nEnglish | [中文](README_cn.md)\n\n[![WebSite](https://img.shields.io/website?up_message=cloudwego\u0026url=https%3A%2F%2Fwww.cloudwego.io%2F)](https://www.cloudwego.io/)\n[![License](https://img.shields.io/github/license/cloudwego/goref)](https://github.com/cloudwego/goref/blob/main/LICENSE-APACHE)\n\nGoref is a Go heap object reference analysis tool based on delve.\n\nIt 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.\n\n## Installation\n\n```\n$ go install github.com/cloudwego/goref/cmd/grf@latest\n```\n\n## Usage\n\nAttach to a running process with its PID, and then use go pprof tool to open the output file.\n\n```\n$ grf attach ${PID}\nsuccessfully output to `grf.out`\n$ go tool pprof -http=:5079 ./grf.out\n```\n\n\u003e Please be aware that `grf attach` will suspend the program until the command exits.\n\nThe opened HTML page displays the reference distribution of the heap memory. You can choose to view the \"inuse space\" or \"inuse objects\".\n\nFor example, the heap profile sampled from a [testing program](https://github.com/cloudwego/goref/blob/main/testdata/mockleak/main.go) is shown below, which reflects the call stack distribution of object creation.\n\n![img_v3_02gq_63631612-6f2d-40ce-8f98-a4e52682ef7g](https://github.com/user-attachments/assets/9fb6bded-3f68-4b73-972d-a273c45b7680)\n\nBy 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.\n\n![img_v3_02gq_53dc2cff-203a-4c06-9678-aae49da4754g](https://github.com/user-attachments/assets/7a6b5a83-e3cd-415f-a5c0-c88d6493e45b)\n\n![img_v3_02gq_54551396-a4ae-42b8-996f-1b1699d381dg](https://github.com/user-attachments/assets/2466c26a-eb78-4be9-af48-7a25e851982a)\n\nIt also supports analyzing core files, e.g.\n\n```\n$ grf core ${execfile} ${corefile}\nsuccessfully output to `grf.out`\n```\n\n## Go Version Constraints\n\n- Executable file: go1.17 ~ go1.24.\n- Compile goref tool: \u003e= go1.21.\n\n## Docs\n\n[How it Works](docs/principle.md) | [Advanced Usage](docs/advanced_usage.md)\n\n## Credit\n\nThanks to [Delve](https://github.com/go-delve/delve) for providing powerful golang debugger.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudwego%2Fgoref","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudwego%2Fgoref","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudwego%2Fgoref/lists"}