2

I'm new to Rust, and this might be a silly question.

Is it possible to get the current memory usage of a variable?

I am writing a programme that uses a lot of memory (which I'd expect), and I'd like to reduce its memory footprint. However premature optimisation is the root of all evil, so before I start playing around with refactoring, I'd like to see what is currently using memory. When I make a change, I'd like to see if what I've done has reduced the memory footprint at all.

My current programme has lots of HashMaps and so forth, so that's the sort of objects I want to measure.

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
Amandasaurus
  • 58,203
  • 71
  • 188
  • 248

0 Answers0