News for hackers. Stuff that matters.
Re:A deep dive into the Go memory allocator and garbage coll... by mwuertinger on Friday August 31, 2018 @04:46AM (#17883965)
Yes this is decided at compile time. If you build your program with `-gcflags '-m'` the compiler will print out detailed escape analysis information. Here's more information: http://www.agardner.me/golang/garbage/collection/gc/escape/a...
Re:A deep dive into the Go memory allocator and garbage coll... by presscast on Friday August 31, 2018 @04:59AM (#17884027)
Nice! So this could presumably be built into a linter (or similar) and be flagged in the editor ... interesting...
Re:A deep dive into the Go memory allocator and garbage coll... by jimmy1 on Friday August 31, 2018 @09:13AM (#17885254)
As a heuristic it would be OK, however, there are some situations where the escape analysis algorithms don't detect certain scenarios so a linter may lead you to believe things are not escaping but in reality they really are, it's also implementation specific, so something that may have escaped in go 1.10 may no longer escape in 1.11 for example.

It's easy enough to profile and benchmark in go, so I would always treat that as the source of truth.

Re:A deep dive into the Go memory allocator and garbage coll... by pcwalton on Friday August 31, 2018 @11:06AM (#17886153)
It would be better to spend this effort to add generational GC with a bump allocator to Go. That way memory allocation becomes faster for everyone, not just the tiny subset of people who use fancy tools.
Re:A deep dive into the Go memory allocator and garbage coll... by weberc2 on Friday August 31, 2018 @11:50AM (#17886535)
I think you've made yourself clear. You've jumped into half a dozen threads in this post with some variation of the same comment as you do with every Go GC post. Your comment is interesting, but repeating it over and over is tiresome. Have you reached out to the Go GC team? What is their response?
Re:A deep dive into the Go memory allocator and garbage coll... by masklinn on Friday August 31, 2018 @05:08AM (#17884061)
IIRC you can't really flag an object as normally escaping so it would be very noisy.
Re:A deep dive into the Go memory allocator and garbage coll... by IshKebab on Friday August 31, 2018 @05:30AM (#17884140)
You could do it with a subtle colouring scheme.
Re:A deep dive into the Go memory allocator and garbage coll... by dis-sys on Friday August 31, 2018 @06:11AM (#17884312)
very nice idea.