by nyanpasu64 · 4y ago · 0 comments
I'm interested in exploring the state of memory management in between pure ownership trees and all-out GC, including stack-allocated structs, refcounting, cycle collection, and per-thread-enabled GCs. I found https://bellard.org/quickjs/quickjs.html and https://news.ycombinator.com/item?id=20413561 when looking for more information on QuickJS's cycle removal, which mentions the "Bacon cycle collector".
In QuickJS:
function Foo() {
let file = new File(...);
file.write("Happy New Year");
}
The file variable (object in it) will be destroyed immediately at the exit from the function.
Which is more suitable in case of Sciter that is embeddable [in native applications] engine.Contrary my TIScript that I was using before had real moving/compacting GC. Objects were freed at GC cycles (in galaxy far far away from invocation).
Now try an data structure, with an unknown size of elements that can non-deterministically scale to several hundreds nodes and delete the graph root node.
Which is why all high performance Ref-counting GC rely on background threads for when RC reaches zero, thus mimicking tracing GC implementations.
"CppCon 2016: Herb Sutter “Leak-Freedom in C++... By Default.”
By the way, C++/WinRT uses background threads to handle cascade deletions of COM references exactly because of this.
https://scholar.google.com/scholar?hl=en&as_sdt=0%2C10&q=bac...
Probably specifically refers to "Concurrent cycle collection in reference counted systems" where Bacon is first author?