What is GC's usual overhead?

And design overhead. A GC can encourage programmers to write algorithms that produce more garbage.

On the other hand, for some GCs, this might give you better performance than a comparable manually-maneged program chunk. A copying generational collector doesn't pay to deallocate anything that immediately becomes garbage, and allocation can be done via a bump allocator.

So if your program repeatedly creates and throws away many, many, many small objects, a copying generational collector will likely have higher throughput than a comparable one using a manually-managed allocator (unless you as the programmer explicitly allocate everything in a bump arena and all your destructors/cleanup functions are trivial and the compiler manages to optimize this cost away).

/r/ProgrammingLanguages Thread Parent