3 ms·
> if the reference escapes the function The difficulty is knowing when that happens, and you're probably guessing wrong (the -m gcflag will tell you). Further
by masklinn 9y ago
> if the reference escapes the function
The difficulty is knowing when that happens, and you're probably guessing wrong (the -m gcflag will tell you).
Furthermore fitting Go's theme the escape analysis is pretty simplistic, so there are many cases where it will somewhat unexpectedly assume escape (note: link is from 1.15, some have been fixed since like the …arg one or the slice assignment): https://docs.google.com/document/d/1CxgUBPlx9iJzkz9JWkb6tIpTe5q32QDmz8l0BouG0Cw/preview# https://docs.google.com/document/d/1CxgUBPlx9iJzkz9JWkb6tIpT...