Hello! I am using runtime.ReadMemStats() which gives my mem allocation by size of the structure (buckets). how do I use the top buckets to find out corresponding data structures in my Go code?
This isn’t saying you have 29MB structs, it says you have 7262 allocations less than or equal to 4096 bytes and greater than some other size (based on the documentation of runtime.ReadMemStats: “BySize[N] gives statistics for allocations of size S where BySize[N-1].Size < S ≤ BySize[N].Size.”). Perhaps that other size is 2048, maybe 1024, maybe 1536, etc… You’d have to check the array to see what that smaller size is.
As far as tracking what those allocations are, I don’t think that information is exposed through any public API.