Comment

Comment by Aurornis

You manually manage memory via ownership rules and lifetimes.

You can allocate memory for a Vec with Vec::new. Dropping it deallocates. When and where it's dropped is important. Passing ownership around is important. These are parts of managing the memory.

If you need something to be on the heap, you use Box. If you need something to be shared, you use something like Arc or Rc.

Rust makes it nice to implicitly handle the common cases so you don't feel like you're doing manual memory management, but you're making decisions about that memory management at every step of the way.

parent Aurornis 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton