On Sun, Feb 23, 2025 at 1:12 PM Gavra <gav...@gmail.com> wrote:

> I have a heap profile that shows that many allocations are generated in a
function that runs in a go routine. Unfortunately, I can't see the
caller(s) to this function, implying I cannot detect the one holding the
reference (and causing the mem leak).
> 1. Can I extract this information from the heap profile?
> 2. If not, can I take a heap profile that will gather this info?
> 3. Why isn't this info available by default? When the go routine is
created, the runtime has all necessary context to indicate the trace call
and forward it, shouldn't it always be the behavior?

You can try something like (adjust the args as needed)

$ go test -run nothing -bench . -memprofile mem.out -memprofilerate 1
-benchtime 4s
$ go tool pprof -lines -web -alloc_space *.test mem.out

HTH

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/CAA40n-U8ePp4H-jyTQo8%3DK5qVpL4gH8dp%2BdTF9JFVpUOQuF1-w%40mail.gmail.com.

Reply via email to