Last active
November 22, 2023 10:01
-
-
Save yumed15/bee552287269aa37ace450f9cb4a55ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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