DEV Community

Cover image for How Rust memory management work to beginners.

How Rust memory management work to beginners.

Canhassi on September 14, 2023

Do you ever thought about what happens to your RAM when you run a program? And how the ways you write code can interfere with many other things in ...
Collapse
 
danielhe4rt profile image
Daniel Reis

I was not even aware about this terminology before. Stack and Heap seems to be a really common thing for low level languages, but since I'm new to Rust this article helped me a lot.

Thanks for the contribution!

Collapse
 
renanvidal profile image
Renan Vidal Rodrigues

OMG Canhas? Big fan here! Great content man!

Collapse
 
karol11 profile image
Andrey S Kalmatskiy

Rust borrow checker does not help with managing object hierarchies in heap. It works only around stack and helps only with synchronous function calls. It doesn't work with asynchronous and multithreaded code. Also Rust does not prevent memory leaks.

Collapse
 
lliw profile image
William Rodrigues

While Rust's memory management may pose initial challenges for beginners, it proves remarkably powerful once mastered. And this article helped me to make this.

Collapse
 
samucadev profile image
SamucaDev

Awesome!!

Collapse
 
nicolab profile image
Nicolas Talle

Good articles.

In multi thread, pay attention to race conditions with references like print_name(&name);

Collapse
 
troiter profile image
John

Technically, &str is simply a reference (an address) which is a fixed size that may point to dynamically created data or static. The only thing on the stack is the address itself, not the actual data, because the slice can also refer to gigabytes of data. I just wanted to make sure there was no confusion and people assumed the slice was a value type. Nice article, btw!

Collapse
 
canhassi profile image
Canhassi

Thank you for the explanation <3

Collapse
 
orionth1 profile image
Matheus Emanoel

Nicee Canhas

Collapse
 
phenriquesousa profile image
Pedro Henrique

Such an inspiration

Collapse
 
nicolus profile image
Nicolas Bailly • Edited

I have never used Rust and don't really intend to, but this article was still fascinating, especially since I suspect those concept are relevant in many other languages.

Thanks !

Collapse
 
mrlazarias profile image
Murilo

Great Article, Cousin

Collapse
 
eduardoromeiro_ profile image
Eduardo Romeiro

Great article

Collapse
 
sofavalentinus profile image
Valentinus Sofa

Great article for Rustacean. Thanks a lot🙏

Collapse
 
marnin_a profile image
Marnin Audu

Great article Canhassi it was really insightful. I noticed a couple of grammatical errors though, you can checkout grammarly to help you refine your articles.👍

Collapse
 
canhassi profile image
Canhassi

thank you for the feedback!!

Collapse
 
offpepe profile image
Alan Albuquerque Ferreira Lopes

great article cousin!

Collapse
 
camilacodes profile image
Camila Figueira

top demais mano

Collapse
 
fransborges profile image
Fran Borges

Great article, congratulations on the content!

Collapse
 
cherryramatis profile image
Cherry Ramatis

Great article cousin, this was such a headache to understand when I was learning rust , your didactics made it quite clear!

Thanks a lot

Collapse
 
ivandragonv2 profile image
Ivan Dragon

Great article <3

Collapse
 
fernandoandrade profile image
Fernando Andrade

amazing content, thanks for writing it

Collapse
 
hellsu profile image
Felipe Costa

Awesome!!

Collapse
 
zoldyzdk profile image
Hewerton Soares

Awesome!

Collapse
 
allen121 profile image
allen
Collapse
 
themegazord profile image
Gustavo de Camargo Campos

I'm really surprise with the feature, I had no idea about is. Congrats