by raverbashing · 2mo ago · 0 comments
(though of course a swap is a swap - but you can "trigger" it depending on your memory or file access pattern)
I still think that reference counting is promising though. First because it meshes well with static analysis memory-management techniques such as inference of uniqueness and borrowing -- that can optimise away RC altogether. (and Swift's compiler already does some of that). I have not seen any work that could optimise away tracing GC in a similar way. Second, because I believe that it would be possible to design hardware with object-memory addressing that would performs atomic reference counting with no additional runtime cost.
Such hardware has been designed in the past, Lisp machines, Ada machines, the famous iAPX 432 Intel's failure.
That loses timeliness, adds problem of queue management.
A weird trick I stumbled across years ago is to not strictly pop from the head of the stack/queue -- instead choose randomly from the last N elements of push end of the stack. This seemed to blunt the sort of growth that you get from "visiting wrong". I never did figure out the theory of why this worked.
The predictable runtime performance is also a myth, because they never take into account the use of NUMA memory, lock contention, possible stack overflow and stop the world in the case of cascaded deletions in naive implementations.
This is proportional to the data structure being deleted.
Unless you use techniques to move the deletion into background threads, e.g. C++/WinRT with COM AddRef/Release, the thread will be "blocked" doing busy work cleaning all those nodes, running the cleanup code (destructors, deinit, whatever), node after node.
I'm not sure most GC implementations worry about the rest neither (as by the several complaints we see going around)
(makes me wonder who's buying those - things like Azul, etc)
Not really, reference counting can cause a single object deallocation to trigger an arbitrarily long chain of deallocations.
Variable time yes but you know when you're going to pay it
(I mean yes you can put your gc.run() there as well, but it might not give you the results you want)
I'm not saying they don't exist of course (or that GC/RC shouldn't cater for them) but it's a very specific use case
Not that much more. Drop the last reference to e.g. a tree and you're doing an arbitrary amount of work to free it, right there. People resort to hacks like sending messages to "freeing threads" dedicated to that.