AmitKumarDas / fun-with-programming

ABC - Always Be Coding
2 stars 2 forks source link

[go] tool #6

Closed AmitKumarDas closed 2 years ago

AmitKumarDas commented 3 years ago
// refer
// - https://blog.detectify.com/2019/09/05/how-we-tracked-down-a-memory-leak-in-one-of-our-go-microservices/
// - https://medium.com/swlh/go-profile-your-code-like-a-master-1505be38fdba
// - https://ozdinc-celikel.medium.com/go-tooling-essentials-7df967f02965
AmitKumarDas commented 3 years ago
// https://mastanca.medium.com/my-raw-notes-on-go-best-practices-concurrency-memory-and-beyond-5d82c1dae110
//
// Sharing down typically stays on the stack
// Sharing up typically escapes to the heap
// Only the compiler knows for sure when typically is not typically
// To get accurate information build your program with gcflags
go build -gcflags=”-m -l” program.go
// When does a variable escape to the heap?
// - If it could possibly be referenced after the function returns
// - When a value is too big for the stack
// - When the compiler doesn’t know the size in compile time