This solved lots of misunderstandings I had about Rust. It should be placed right in the documentation of the language (at least a link, so one could find it easily and early on the rust book)
This is not just a great video for Rust developers, but a great introduction for all developers into the process' memory layout and workings of the operating system!
Just remember about the memory layout of things like structs. You CANNOT rely on the memory layout or ordering of fields to be a certain way, as it's not defined how it will end up. If you need to rely on this, you need to use things like `#[repr(C)]`. In fact, not even the tuple struct's memory layout is guaranteed. To guarantee it, you would need to use `#[repr(transparent)]`
Genuinely, thank you SO much for this video. I was banging my head against a wall trying to PRECISELY understand fat pointers, why str is a primitive type, and other low-level questions
Great video. I wanted to check out Rust for use in userspace applications, however the types seemed too high level and convoluted to me, since I primarily program in C. This video helped visualize the types and allows me to think of them in a more familiar C like way and visualize them in memory. I feel like every languages needs videos like this, as it makes mechanisms within the language more explicit and easy to understand in simpler terms.
I was looking for info on dynamically sized types, but I found so much more in the video. One of the clearest explanations for such confusing concepts in Rust. Great video!
Great lecture, but in the future, consider asking a friend to narrate! I know a lot of people don’t like posting themselves online, but many people would probably be happy to help out! :)
Beautiful, I'd consider the topics covered here to be required knowledge, and the video is a nice way to present things that can be difficult to visualize.
this is the best memory video ever made. I downloaded it because of fear to lose it if youtube servers shut down or volcano, earthquake, meteor or something... lifesaving enum memory tip @23:55
It would be awesome if you put more Rust-related videos with the same level of explanation. IMHO there are a lot of videos of Rust internals available on TH-cam but only a few like this, are actually understandable by novice Rustaceans.
*UPDATE: This video is re-uploaded with a better audio here* th-cam.com/video/7_o-YRxf_cc/w-d-xo.html Corrections: * 6:10, it should be 2^64 - 1 (without parenthesis) * Trait is dynamically sized. Trait object has known size.
28:22 this isn't precise. Gargabe collection (as in JS, Go or Java) does not keep track of refernces. In its cleanup run GC just checks wether there is a reference to this memory or not and after it is finished it forgets about it. Your description fits more to automatic reference counting used by Objective-C and Swift.
* trait objects are dynamically sized types, meaning that their size is known at runtime. Pointer types to trait objects are sized at compile-time but have twice the size of pointers to sized types. Correct me if i got something wrong
The mention of "malloc" made me think of the assertions around self-compiled language aspects, something I first remember hearing about with Pascal, then C. I presume then this does not include the libc and some other libraries, or perhaps just not always. I guess if it is a clang compilation, by implication, it's not self-compiled, so perhaps the assertion is it is self-compiled in some environments, or that some copies are self-compiled, or that the core of the compiler is self-compiled, but not all the libraries it uses.
Great video, thanks! At 6:10, there is an error for the address range. The caption reads 2^(64-1), which is incorrect, as it implies 2^63 because of the parenthesis. The parens either needs to be removed, or put around the exponent to be correct.
Why the Array(Vec) variant of the Data enum is stored in stack if in the Vector section of the video it was explained that Vectors were stored in the heap so they can grow.
The three elements that constitute the Vec header (pointer to data, length and capacity) are stored on the stack. The Vec elements will be stored in the heap.
@@sreekanthpr thank you!!!!, I watched that section again and now I understood it better. I loved this visual explanation, everyone else does it with charts and words, but having it visually explained like you did totally improves and easies the understanding of these abstractions. Again, thank you!
Is it possible to make borrow-checker to take care of individual structure fields? I mean I want to pass the whole structure mutable reference in/out for functions, but to make the borrow-checker to care about what fields has been modified. Is it?
Time 23:08... the szie of the `Data` enum is 24 bytes, not 32 bytes. The largest variant is the Vector, which is 24 bytes, hence the enum is also 24 bytes. You should check your presentation/video before publishing.
18:50 Couldn't the compiler get the size for a slice from it's initializer? It should know the size is 2 if I say 0..2. It's something like `constexpr` in C++.
This solved lots of misunderstandings I had about Rust. It should be placed right in the documentation of the language (at least a link, so one could find it easily and early on the rust book)
Maybe the ownership is different, but everything else is school thing explained here.
@@MrEnsiferum77 could you point me to a program or a book where theese things are taught to people?
This was extremely enlightening in visualizing rust's memory model. Thank you for taking the time to create this!
This is not just a great video for Rust developers, but a great introduction for all developers into the process' memory layout and workings of the operating system!
Fax
Just remember about the memory layout of things like structs. You CANNOT rely on the memory layout or ordering of fields to be a certain way, as it's not defined how it will end up. If you need to rely on this, you need to use things like `#[repr(C)]`.
In fact, not even the tuple struct's memory layout is guaranteed. To guarantee it, you would need to use `#[repr(transparent)]`
这个视频实在讲的太好了,解答了我好多关于Rust的疑惑以及Java中的一些疑惑!!追过来点赞
Genuinely, thank you SO much for this video. I was banging my head against a wall trying to PRECISELY understand fat pointers, why str is a primitive type, and other low-level questions
I was confused about box, rc, and arc until now. Thanks!
Wow, I really love this. Nice refresher of multiple topics even for someone who is intermediate-advanced rust user.
Definitely the best Rust video on TH-cam. I will keep this video and watch again and again! 감사합니다🙏
I'm really impressed, what a great content avaliable for FREE! Please keep up uploading videos.
Great video. I wanted to check out Rust for use in userspace applications, however the types seemed too high level and convoluted to me, since I primarily program in C. This video helped visualize the types and allows me to think of them in a more familiar C like way and visualize them in memory. I feel like every languages needs videos like this, as it makes mechanisms within the language more explicit and easy to understand in simpler terms.
Thank you Sreekanth. Coming from a C background, this really helped me understand what Rust is about.
I was looking for info on dynamically sized types, but I found so much more in the video. One of the clearest explanations for such confusing concepts in Rust. Great video!
The best video on vtable , Smart pointers, trait object..Awesome job. Thanks
Jesus Christ. This is so awesome explanation. Thanks to you I can be now understanding how stack and heap grows up
This is very clear and great explanation on rust memory management. thanks for the explanations
Thank a lot, this makes learning Rust a lot easier. The less magic the better.
Rust is the way forward and this is a great piece of work. Thanks.
finally I've understood strings in rust. thank you a lot!
A nice overview and/or refresher.
Great lecture, but in the future, consider asking a friend to narrate! I know a lot of people don’t like posting themselves online, but many people would probably be happy to help out! :)
Hats off for making everything clear🙌 You're extremely talented. You're able to explain things logically by providing reasons. Thanks❤️
Beautiful, I'd consider the topics covered here to be required knowledge, and the video is a nice way to present things that can be difficult to visualize.
Thanks for this. It is brilliant!
Very useful and nice depiction of memory layout of each data type. It should be placed right inside the documentation
This video will remain as the best go-to video for new rustaceans! Excellent work Sreekanth!!!
This is worth more than some of computer arch classes at university.👍
the best introduction has ever seen.
this is the best memory video ever made. I downloaded it because of fear to lose it if youtube servers shut down or volcano, earthquake, meteor or something... lifesaving enum memory tip @23:55
This video help me understand rust memory a lot , thanks ~
Extremly well delivered information with not a single wasted second. Very good work!
Easy to understand video for complex concepts. Thanks for sharing.
It would be awesome if you put more Rust-related videos with the same level of explanation. IMHO there are a lot of videos of Rust internals available on TH-cam but only a few like this, are actually understandable by novice Rustaceans.
Hey! Great video! I’d love to do a voiceover for this to make it easier to listen to.
*UPDATE: This video is re-uploaded with a better audio here* th-cam.com/video/7_o-YRxf_cc/w-d-xo.html
Corrections:
* 6:10, it should be 2^64 - 1 (without parenthesis)
* Trait is dynamically sized. Trait object has known size.
28:22 this isn't precise. Gargabe collection (as in JS, Go or Java) does not keep track of refernces. In its cleanup run GC just checks wether there is a reference to this memory or not and after it is finished it forgets about it. Your description fits more to automatic reference counting used by Objective-C and Swift.
by which software are the pictures drawn?
@@shumudu5377 For this video, I used Powerpoint. For all other videos in this channel, I use manim library (Python).
at 28:10, I suppose the indices should be 0, 1, 2 instead of 0, 2, 3.
btw great video, thanks you ❤
* trait objects are dynamically sized types, meaning that their size is known at runtime.
Pointer types to trait objects are sized at compile-time but have twice the size of pointers to sized types.
Correct me if i got something wrong
Visualization helps a lot, thanks!
I recently started with rust and holy shit i can'ttell how helpful this was
This is awesome! I didn't know that I needed this that badly! Thanks for sharing this great work!
Really appreciate this video, thank you
This video is so good and easy to understand
The mention of "malloc" made me think of the assertions around self-compiled language aspects, something I first remember hearing about with Pascal, then C. I presume then this does not include the libc and some other libraries, or perhaps just not always. I guess if it is a clang compilation, by implication, it's not self-compiled, so perhaps the assertion is it is self-compiled in some environments, or that some copies are self-compiled, or that the core of the compiler is self-compiled, but not all the libraries it uses.
This video is gold. Thanks for the hard work!
This is the best explain to Rust
Nice work! Hope to see more Rust videos from you.
Your video helped me a lot. Thank you.
The best video!!! Thnx
This is gold! Congrats :)
Great explanation. Love to see more such deep dive video about Rust.
Great video, thanks!
At 6:10, there is an error for the address range. The caption reads 2^(64-1), which is incorrect, as it implies 2^63 because of the parenthesis. The parens either needs to be removed, or put around the exponent to be correct.
Thank you. Happened during the final subtitle edits. It was written in words for generating the sound in the original text.
need more videos like this
thank you for sharing knowledge. appreciate the effort.
This makes so much more sense! Could you please cover RefCell?
bruh I loved this video. thanks for your great content.
Such wisdom, oh great one.
very informative! thank you
Amazing video! Would be awesome if you made more videos like this for Rust
Wonderful. So thorough.
An unsecure low shy stuttering voice sounds always better than any AI voice.... Remember this for your next videos
Thank you man for sharing this stuff
awesome explanation 👏👏👏👏👏
I cannot thank you enough 🙏
This is exactly i want. Thank you!
Bro this was so cool, loved the video even tho it was with an AI voice, usually dont like those but the content was NOICE
This is golden, thanks!
This video is beautiful
We rustacean loved it! you should create more videos about rust, like this one!
O Captain! My Captain! Are you going to publish a book? I think we need more lectures for memory dynamics.
This is so useful! Thanks
very good and clear
Thank you! this was very helpful.
Dude, amazing work! Just amazing
Wow, honestly incredible
This is high quality stuff!
Great explanation! Thanks
Awesome explaination
Could you put it in the video description of what NTTS model/engine you are using to dub this amazing video?
I use Microsoft onenote/word >> View >> Immersive Reader
Why the Array(Vec) variant of the Data enum is stored in stack if in the Vector section of the video it was explained that Vectors were stored in the heap so they can grow.
The three elements that constitute the Vec header (pointer to data, length and capacity) are stored on the stack. The Vec elements will be stored in the heap.
@@sreekanthpr thank you!!!!, I watched that section again and now I understood it better. I loved this visual explanation, everyone else does it with charts and words, but having it visually explained like you did totally improves and easies the understanding of these abstractions. Again, thank you!
It is a cool video. Not only for Rustaceans.
19:54, I wish that proper memory visualizations were given for string and str as they are not represented in memory the same way.
Amazing video thanks.
this is the best video I have ever watched on youtube
love to learn thanks for sharing
Incredible explanation, it makes it so much easier to understand compiler errors when you have this video and memory mapping in mind. Thanks !
Is it possible to make borrow-checker to take care of individual structure fields? I mean I want to pass the whole structure mutable reference in/out for functions, but to make the borrow-checker to care about what fields has been modified. Is it?
24:30 The malloc implementation will have some overhead (at least 8 bytes) in managing the extra heap allocation.
love it help me a lot i hope you do cargo next!
Thanks!!! Your video is too good
good stuff, thank you very much
That was very useful 👍
great work, very helpful for me
holy shit this was amazing
Time 23:08... the szie of the `Data` enum is 24 bytes, not 32 bytes. The largest variant is the Vector, which is 24 bytes, hence the enum is also 24 bytes. You should check your presentation/video before publishing.
possibly the single most based rust video on yt
nice!
could u pls tell us how did you make these videos like tools and the digital voice
All visuals: Powerpoint
Audio: Ms one note >> view >> immersive reader + Audacity for recording audio
Video editing: davinci resolve
just beca a subscriber keep up the good work Sir.
I was looking forward to this video wehn seeing the title and then bam! Text to speech 😢
The video was cool anyways
Is this documented somewhere? Where did you find the info to make the video? Awesome video by the way.
Rust specific things are mostly from the book "Programming Rust" (mentioned in video description)
Enlightening! Thank you!
Thank you so much
18:50 Couldn't the compiler get the size for a slice from it's initializer? It should know the size is 2 if I say 0..2. It's something like `constexpr` in C++.
extremely well done video!