
A deep dive into Go's stack
Go Time: Golang, Software Engineering
How to Control What Goes on the Stack
When you create a local variable, for instance, it's going to be on the stack or when you pass an argument to a function, it's probably on the end of the stack. The place where this kind of gets complicated is that what's not on the stack, which is things that are on the heap. And so overall, the general idea is put as much things on the stack because the stack, as David said, is scratch storage. It does not need the garbage collector. Only if you need to use pointers and only if you need something on the heap, you'll do that just to avoid the overhead of the garbage collector running.
00:00
Transcript
Play full episode
Remember Everything You Learn from Podcasts
Save insights instantly, chat with episodes, and build lasting knowledge - all powered by AI.