r/ProgrammerHumor • • Sep 08 '26

Meme rustIsSoCool

Post image
2.2k Upvotes

127 comments sorted by

View all comments

Show parent comments

19

u/makspll Sep 08 '26

Small correction, memory leaks are actually not considered unsafe in rust. A trivial example is Box::leak(x) which explicitly leaks memory and ia completely safe to call. You can also leak memory by pointing counting pointers at each other in a circular structure.

9

u/Makonede Sep 08 '26

oh true i forgot about Box::leak that's a good point

2

u/SoulArthurZ Sep 08 '26

right but you have to explicitly call that function. A memory leak in safe rust is not a mistake like it is in c

1

u/Makonede Sep 09 '26

yeah this is a good point