|
|
|
|
|
by MaulingMonkey
1976 days ago
|
|
There are GCs that take this approach (refcount + sweeps to break cycles). It has tradeoffs however. - Extra space for every object to have a refcount - Extra refcount bookkeeping every time you (re)assign a reference (possibly triggering cache thrashing/false sharing in some multithreaded scenarios), xchgs instead of movs, etc. - Pointless if you're using bump allocators (they can't reuse the 'freed' memory until the next GC cycle compacts memory anyways), so you're forced to use more complicated allocator designs if you're to reuse said memory. Cycles mean it still doesn't give you 100% deterministic object destruction either, so you want extra mechanisms for disposing unmanaged resources at controlled times ala IDisposable anyways. |
|