TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A deep dive into the Go memory allocator and garbage collector

182 pointsby beyangover 6 years ago

5 comments

beliuover 6 years ago
GopherCon liveblogger here. The room was jampacked for this talk and it did not disappoint. A very detailed tour of how memory allocation and GC works in Go. I learned a ton. Eben (<a href="https:&#x2F;&#x2F;twitter.com&#x2F;_emfree_" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;_emfree_</a>) has also posted his slides here: <a href="https:&#x2F;&#x2F;speakerdeck.com&#x2F;emfree&#x2F;allocator-wrestling" rel="nofollow">https:&#x2F;&#x2F;speakerdeck.com&#x2F;emfree&#x2F;allocator-wrestling</a>.<p>FYI, this was part of a technical liveblog that covered all the talks at GopherCon this year in a similar fashion. If you missed the conference or are looking to review material, you might find <a href="https:&#x2F;&#x2F;sourcegraph.com&#x2F;gophercon" rel="nofollow">https:&#x2F;&#x2F;sourcegraph.com&#x2F;gophercon</a> helpful. (Disclosure: I&#x27;m CTO of Sourcegraph—we organized the liveblog and love Go!)
评论 #17882873 未加载
评论 #17883933 未加载
sephamorrover 6 years ago
The suggestion to reuse objects, rather than reallocate temporaries (e.g. inside a loop body) was intriguing. Coming from C&#x2F;C++ where stack allocations are approximately &#x27;free&#x27;, I tend to scope stack variables as narrowly as possible for readability and to help the compiler break dependencies. This is an interesting paradigm change that I wouldn&#x27;t have expected from Go.
评论 #17884194 未加载
评论 #17883708 未加载
评论 #17884562 未加载
评论 #17883573 未加载
joaodlfover 6 years ago
If this topic interests you, André Carvalho did another great talk on the subject at Gophercon UK earlier this month: <a href="https:&#x2F;&#x2F;speakerdeck.com&#x2F;andrestc&#x2F;understanding-go-memory-allocation-gophercon-uk" rel="nofollow">https:&#x2F;&#x2F;speakerdeck.com&#x2F;andrestc&#x2F;understanding-go-memory-all...</a>
ebikelawover 6 years ago
Their allocator architecture seems very similar to tcmalloc, which maybe makes sense if all those people sit together at Google.
评论 #17885591 未加载
ameliusover 6 years ago
I wish a powerful GC like the one in GoLang was built into e.g. LLVM, so other languages could profit from it as well.
评论 #17884403 未加载
评论 #17885249 未加载
评论 #17895386 未加载