Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardGoEscape analysisSingle-choice MCQ

Escape analysis decides whether `x` is stack- or heap-allocated. For the function below, what does Go's escape analysis conclude about the slice backing array, and why?

func build() []int { s := make([]int, 0, 4) s = append(s, 1, 2, 3) return s }