Skip to content

Instantly share code, notes, and snippets.

@yumed15
Last active November 22, 2023 10:01
Show Gist options
  • Save yumed15/bee552287269aa37ace450f9cb4a55ba to your computer and use it in GitHub Desktop.
Save yumed15/bee552287269aa37ace450f9cb4a55ba to your computer and use it in GitHub Desktop.
package main
type hugeT struct {
a [3 * 1000 * 1000]int32 // 12MB
}
func main() {
// l1 escapes to heap: too large for stack
l1 := hugeT{}
// l2 escapes to heap: too large for stack
l2 := make([]int32, 0, 17*1000) // 68KB
_ = l1
_ = l2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment