|
|
Subscribe / Log in / New account

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

This is not quite how I understand the documentation.

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.


to post comments

Not just Ada...

Posted Apr 26, 2013 23:18 UTC (Fri) by ibukanov (subscriber, #3942) [Link]

> The thread-shared heap is not reference counted.

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.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds