Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by LinusU

10 days ago

Memory safety has nothing to do with memory leaks, and it's perfectly valid to leak memory in Rust?

e.g. `Box::leak(Box::new( ... ))`

2 comments

LinusU

Reply

satvikpendem  10 days ago

Generally it's automatically dropped unless you go out of your way to use the leak function, which most software doesn't do.

nicoburns  10 days ago

Memory safety doesn't help too much here, but "RAII" (automatically dropping values when they go out of scope) does.

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities