Hacker News new | ask | show | jobs
by chubs 1419 days ago
I searched on several sites to find out what their memory management strategy is but couldn’t figure it out. GC? ARC? Whatever Rust does? Would love to see where this fits. Exciting to see a neat new language though! Also my second favourite feature of rust and swift is Enums with associated values, I can’t see any info on this but I saw a blog mention they have it.
3 comments

I think it's manual memory management, but with effort made to make that easier to handle and easier for tooling to check. With a plan to have a memory safe subset at some time in the future but not as part of the 0.1 designs.
> I searched on several sites to find out what their memory management strategy is but couldn’t figure it out.

Carbon might be shy about its footprint.

Scope-bound resource management, like C++.

GC and ARC are for people that need shared ownership, which is pretty much always a bad idea.

So how do you implement multithreading if the above are a bad idea?
The thread lifetime is also scope-bound, to ensure the thread dies before any object it might be referring to does.
Sorry, I meant how to guard against race conditions where multiple threads try to write to the same shared memory?

This is clasically done via memory synchronization mechanisms/atomics.

I don't understand how this has anything to do with lifetime management, which is what GC/RC/ARC are for.

You do need to synchronize concurrent access to the same object, and it's not just concurrent writes, it's concurrent accesses if at least one of them is a write.

Deep copy on passing between threads. Interesting pros and cons to the performance of that vs sharing pointers.
There is no need to copy objects for multiple threads to refer to them.

It's just that there is a single owner, and the other threads have a non-owning view only.

You need strict control on the thread lifetime, which is enforced through the same single ownership system, in order to enforce this.