Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
undefined | Better HN
0 points
packetlost
2y ago
0 comments
Share
it depends. I
believe
map literals are stack allocated if they aren't shared across goroutines or globals.
0 comments
default
newest
oldest
masklinn
2y ago
While the hmap struct can be stack allocated if it does not escape, I’m pretty sure the buckets still need to be heap-allocated. I do not believe hmap has a “flat structure” variant which could live entirely on the stack, though I could be wrong.
j
/
k
navigate · click thread line to collapse