3 ms·
> GC languages are memory hogs This is unrelated to GC. > The cost of having GC is that you pay with higher memory usage for doing GC in batches thanks to whi
by weberc2 10y ago
> GC languages are memory hogs
This is unrelated to GC.
> The cost of having GC is that you pay with higher memory usage for doing GC in batches thanks to which you do not have to pay for single deallocations. So this performance advantage cannot be used in embedded space because there is no free memory for it, you would need to GC all the time which would kill the performance.
The same is true for C. You don't get to make frequent allocations for free in any language. You have to trade space for performance; in GC-land, the answer is tuning the collector. In Go, this is one knob: the GOGC env var.