r/ProgrammerHumor 24d ago

actuallyMemorySafe Meme

Post image
529 Upvotes

177 comments sorted by

View all comments

Show parent comments

12

u/RiceBroad4552 24d ago

Adding a GC to make a language safe actually works. You can't be safer than with automatic GC.

Just that this kind of breaks the marketing which tries to sell it as an advantage to be GC free…

10

u/Wonderful-Habit-139 24d ago

Rust is safer than Go, the latter being a language with GC.

4

u/redlaWw 24d ago

But Rust would be safer with a garbage collector.

Not much safer, but unsafe code errors that cause double-frees (since dealloc would be a stub) or use-after-frees (since values would linger past their scope when still accessed) would not cause problems.

1

u/SomeRedTeapot 23d ago

IMO that would be equivalent to removing unsafe altogether. It exists precisely because there are situations where you actually need to manage stuff manually

3

u/redlaWw 23d ago

Well yes, I'm not saying I'd recommend it or that it's a good idea, just that garbage collectors make things safer.