Y
Hacker News
new
|
ask
|
show
|
jobs
by
packetlost
1036 days ago
it depends. I
believe
map literals are stack allocated if they aren't shared across goroutines or globals.
1 comments
masklinn
1035 days 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.
link