News for hackers. Stuff that matters.
Re:Go 1.18 by Laremere on Tuesday March 15, 2022 @02:55PM (#30689427)
Go uses escape analysis to ensure memory safety of pointers. Taking a reference of a local variable means it might end up on the heap, and calling new might allocate on the stack. It all depends on if Go can determine that the lifetime of the pointers is less than the stack frame.

It's good if you don't want to care about those details, it's bad if you really care about those details for performance reasons.

There are no comments on this comment yet.