5 ms·
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 wher
by chubs 4y 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.
- mgaunard 4y agoScope-bound resource management, like C++. GC and ARC are for people that need shared ownership, which is pretty much always a bad idea.
- mihaigalos 4y agoSo how do you implement multithreading if the above are a bad idea?
- JonChesterfield 4y agoDeep copy on passing between threads. Interesting pros and cons to the performance of that vs sharing pointers.
- mgaunard 4y agoThere 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.
- mgaunard 4y agoThe thread lifetime is also scope-bound, to ensure the thread dies before any object it might be referring to does.
- mihaigalos 4y agoSorry, 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.
- mgaunard 4y agoI 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.
- markmark 4y agoI 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.
- golemotron 4y ago> 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.