46
you are viewing a single comment's thread
view the rest of the comments
[-] bluGill@kbin.social 8 points 10 months ago* (last edited 10 months ago)

I have garage collection in C++. Unique-ptr takes care of almost all my needs (and the exceptions are places where I need to subvert the system and so other garbage collection is a non starters) There is a lot more to memory safety than garbage collection though.

Memory safety does not require garbage collection. Rust doesn't have garbage collection and is memory safe because they annotate the lifetime of each object so that you can't have a use after free error - the only part of memory safety garbage collection helps with. Memory safety is also about not accessing past the end of a buffer, and garbage collection does nothing to help you here. There are a number of other memory safety issues that garbage collection doesn't help with. (most garbage collected languages also give you those things, but it isn't the garbage collector doing that work)

this post was submitted on 22 Sep 2023
46 points (97.9% liked)

Rust

5590 readers
32 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS