How does Go handle heap allocation?

Written by
Link to Post

https://www.reddit.com/r/golang/comments/aeyki9/how_does_go_handle_heap_allocation/

Does Go pre-allocates a chunk of memory and take from it for each allocation (like JVM), or it allocates every time a variable is created, and is it a kernel call (malloc)?

If it is one kernel call per allocation, that would make variable creation expensive. How can I force allocation on the stack/heap?

submitted by /u/texasbruce
[link] [comments]

Article Tags:
· ·
Article Categories:
reddit

Leave a Reply