3 ms·
Sure. malloc'ed item could be the same as malloc_gc'd, but with its reference count artificially bumped up by 1. free() would decrement the count and the item
by huhtenberg 16y ago
Sure.
malloc'ed item could be the same as malloc_gc'd, but with its reference count artificially bumped up by 1. free() would decrement the count and the item will be picked up by the GC later on. If there's a provision for an immediate disposal of unreferenced items, then we are back to the standard malloc/free behaviour in case when malloc and malloc_gc items are not mixed.
- p0nce 16y agoReference counting is a bad C++ substitute for a real GC.
- huhtenberg 16y agoSure, absolutely. Just as C++ is a bad substitute for a real language. (edit) </sarcasm>