Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jayantxie authored Nov 19, 2024
1 parent ea0c256 commit 51b58f4
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

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 GC overhead.
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

Expand All @@ -25,13 +25,18 @@ $ go tool pprof -http=:5079 ./grf.out

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 following picture is a Heap Profile of pprof. It can be seen that the objects are mainly allocated by `FastRead` function, which is Kitex's deserialization code. This flame graph is not very helpful for troubleshooting because memory allocation for decoding and constructing data is normal.
For example, the heap profile sampled from a Kitex RPC service is shown below, which reflects the call stack distribution of object creation. The largest proportion, FastRead, is the function for object deserialization.

![image](https://github.com/user-attachments/assets/495d0884-332a-4570-b41b-3019e4d9b3c1)



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.

![image](https://github.com/user-attachments/assets/9f547dc8-6b40-439b-9aee-6c5de8dfdee5)

![image](https://github.com/user-attachments/assets/799c1b9a-fcf0-4b35-ab15-03a2bf3a919e)

However, by using the goref tool, the following results can be seen: `mockCache` holding onto RPC's Response causing memory not to be released, making the problem clear at a glance.

![image](https://github.com/user-attachments/assets/1c3d5d29-953d-4364-84b9-69ae35f51152)



Expand Down

0 comments on commit 51b58f4

Please sign in to comment.