Skip to content

Commit

Permalink
Update principle.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jayantxie authored Jul 22, 2024
1 parent 553d967 commit 172e531
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions docs/principle.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
As a Go developer, we may encounter situations of memory leaks from time to time. Most people would attempt to take a heap profile as their first step to identify the cause of the problem. However, in many cases, the heap profile flame graph is not very helpful for troubleshooting because it only records where objects are created. In complex business scenarios where objects are passed through multiple layers of dependencies or memory pools, it becomes almost impossible to locate the root cause based solely on the stack information of object creation.

Take the following heap profile as an example. The stack of the FastRead function is a deserialization function in the Kitex framework. If a business goroutine leaks a request object, it actually cannot reflect the corresponding leaked code position but only shows that the FastRead function stack occupies memory.

![image](https://github.com/user-attachments/assets/462ee4da-02d0-465c-90ee-c1c59fc86dc9)

As we all know, Go is a language with a garbage collector (GC). If an object cannot be released, it is almost 100% due to the fact that the GC marks it as alive through reference analysis. As a GC language, Java's analysis tools are more advanced. For example, JProfiler can effectively display object reference relationships. Therefore, we also want to develop an efficient reference analysis tool for Go that can accurately and directly show us memory reference distribution and reference relationships, liberating us from difficult static analysis.
Expand Down

0 comments on commit 172e531

Please sign in to comment.