Not just Ada...
Not just Ada...
Posted Apr 26, 2013 22:20 UTC (Fri) by neilbrown (subscriber, #359)In reply to: Not just Ada... by ibukanov
Parent article: A taste of Rust
The thread-local heap is managed, though they currently use reference counting rather than mark/sweep garbage collection. That might change.
The thread-shared heap is not reference counted. The compiler tracks references of which there may only be on primary reference and possibly several borrowed references that can only exist within the scope of the primary reference. When the primary reference is dropped, the object is freed. No counting.
Posted Apr 26, 2013 23:18 UTC (Fri)
by ibukanov (subscriber, #3942)
[Link]
You are right, the ownership is fully tracked with the compiler.
> The thread-local heap is managed, though they currently use reference counting rather than mark/sweep garbage collection.
It is reference counting plus a cycle collector. For practical purposes it is just a form of GC with different trade-offs compared with a mark and sweep case. In Rust the reference counting allowed for simpler compiler implementation as one does not need to track the native register and stack roots. Plus for non-cyclic cases the garbage is collected faster. But when the cycle collector runs, it runs much slower than a mark-and-sweep due to significantly more complex algorithm.
Not just Ada...