Created
November 22, 2023 10:04
-
-
Save yumed15/2784561f2007e90634a4af2575adf5c2 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
func f1() **int { | |
// t escapes to heap | |
t := 0 | |
// x1 escapes to heap | |
x1 := &t | |
return &x1 | |
} | |
func f2() *int { | |
// t escapes to heap | |
t := 0 | |
x2 := &t | |
return x2 | |
} | |
func f3() int { | |
t := 0 | |
x3 := t | |
return x3 | |
} | |
func f4() map[string]int { | |
// kv escapes to heap | |
kv := make(map[string]int) | |
return kv | |
} | |
func f5() []int { | |
// s escapes to heap | |
s := []int{} | |
return s | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment