|
|
|
|
|
by simiones
196 days ago
|
|
Depending on escape analysis, the array underlying the slice can get allocated on the stack as well, if it doesn't escape the function context. Of course, in this case, because we are returning a pointer to it via the slice, that optimization isn't applicable. |
|
Both arrays in this example seem to be on the heap.