2 ms·
> Not sure how to verify this, but the assumption you can allocate megabytes on the stack seems wrong. []byte{N: 0}
by masklinn 11mo ago
> Not sure how to verify this, but the assumption you can allocate megabytes on the stack seems wrong.
[]byte{N: 0}
- deleted 11mo ago[deleted]
- Yokohiii 11mo agodoesn't make sense.
- masklinn 11mo agoAnd yet it does: https://godbolt.org/z/h9GW5v3YK https://godbolt.org/z/h9GW5v3YK And creates an on-stack slice whose size is only limited by Go's 1GB limit on individual stack frames: https://godbolt.org/z/rKzo8jre6 https://godbolt.org/z/rKzo8jre6 https://godbolt.org/z/don99e9cn https://godbolt.org/z/don99e9cn
- Yokohiii 10mo agoYea with more context it suddenly makes sense :p Interesting, [...] syntax works here as expected. So escape analysis simply doesn't look at the element list.