|
|
|
|
|
by _lbaq
3318 days ago
|
|
Heap allocation and smartpointers (as an alternative to GC) is by no means free, in that context GC performance favorable in many scenarios, for example when doing large number of small allocations. But in the end, if your application have serious performance requirements, you should avoid allocating memory in the hot path altogether. |
|
Fun fact: the Go GC is written in pure Go code, which does not perform any heap allocations. So there is enough control to write code in Go which does not require any heap allocations. There is even a compiler switch for the development of the GC code which makes heap allocations a compile error.