P.S.: I'm not 100% sure that my answers are correct :D
The final (I hope) ARC/ORC related RFC has arrived: https://github.com/nim-lang/RFCs/issues/244
Finally addressing multi-threading aspects.
If you share a ref based tree data structure between threads, can you safely read from it without locking?
My understanding is that, since ARC does not use atomic inc/dec, even reading without locks would be dangerous since the refcounts could become corrupted. Even read-only access can generated retain/release pairs.
@Araq: Congratulations on a great milestone!
Any guidance on when the next release with ORC/ARC as default GC will see the light of the day?
Async and ORC works on embedded!
Unfortunately, the GC trigger point / cycle count limit is set too high for embedded usage. On my desktop a simple asynchttpserver serves about 400 requests before running the cycle collector. Embedded crashes after about 10 requests. I tried GC_enableMarkAndSweep but it didn't appear to change when cycle collection occurs. However, GC_fullCollect does force a full cycle collect.
For general usage, I'd prefer being able to modify when ORC runs collections. For embedded it needs to be as small as possible! A few extra cycles running the GC are often preferred given the lack of memory. I've tried setting InitialCycleThreshold and InitialZctThreshold but without much effect. Is there an appropriate parameter for minimizing the absolute memory usage?
I'm confused. On the one hand, "Offers a shared heap." But on the other hand, "Well you cannot share them, you can move them around."
If there is a shared heap, why can't we share?
If there is a shared heap, why can't we share?
Because ref-count inc/dec operations are not atomic. (Atomic ops are an order of magnitude slower.) That means if the same object has references on multiple threads, its ref-count can get corrupted by overlapping reads/writes.
The advantage of the shared heap (over the old per-thread heaps) is that an object reference can trivially be moved from one thread to another, just by passing a pointer. This is exactly the same thing Rust does.