3 ms·
> Modern gcs can be pauseless, but either way you’re spending CPU on gc and not servicing requests/customers. Since memory is finite and all computation uses s
by pron 1y ago
> Modern gcs can be pauseless, but either way you’re spending CPU on gc and not servicing requests/customers.
Since memory is finite and all computation uses some, every program spends CPU on memory management regardless of technique. Tracing GCs often spend less CPU on memory management than low-level languages.
> std::unique_ptr has no ref counting at all.
It still needs to do work to free the memory. Tracing GCs don't. The whole point of tracing GCs is that they spend work on keeping objects alive, not on freeing memory. As the size of the working set is pretty much constant for a given program and the frequency of GC is the ratio of allocation rate (also constant) to heap size, you can arbitrarily reduce the amount of CPU spent on memory management by increasing the heap.