I watched all videos in "Smart Pointers" mini-series, and this part about Rust is truly terrifying! I once tried to code various algorithms on CodeForces in Rust, but seemingly trivial stuff didn't even compile. I now (I think) understand why, but writing so much code is just confusing. As before, it would be cool, if you showed how to implement this stuff yourself for even better and deeper understanding. I also wonder about performance implications: merely traversing a list consisting of (trivial implementation) reference counting smart pointers would cause each pointer-count in the list to be incremented and then decremented.
So, the allocation that a reference counting pointer points at gets released as soon as the strong count goes to 0.. but somehow, the remaining weak references magically know that that has happened. So either a list of them is kept somewhere, and they all get notified/updated (extremely unlikely), or, the reference counting pointer actually points to some kind of separate allocation which is updated. And this separate allocation is Not cleaned up when the strong count goes to zero. Which begs the question - is it ever cleaned up? If so, when? When both the strong and the weak counts go to 0? This also suggests that the high cost of following a pointer to the heap (the potential for a CPU cache miss) is.. something like doubled.. for reference counted pointers.
I really appreciate your videos. Your explanations and examples are super understandable and make learning Rust a lot easier. Thanks for the hard work. Greetings from Switzerland 👍
In short, can we say if we have a weak reference, that can be cleared from memory after the scope ends ? Ex : leaf holding the branch as a weak reference, So here branch can be cleared even it getting holder by leaf as a weak reference ... am I correct
This is the part of Rust where I dont understand anymore xD Too much pointers and I don't see a good reason of using unless you are doing some data structures shit
📝 Get your *FREE Rust cheat sheet* : www.letsgetrusty.com/cheatsheet
Miku Miku BEAMMMMMMMMMMMMM! 💖💖
Music Name plss!!!
Very clean and concise explanation of stuff that I didn’t even understand in Uni
This is by far the clearest explanation on youtube about Rust Reference Cycles, Good job , Bogdan !
I watched all videos in "Smart Pointers" mini-series, and this part about Rust is truly terrifying!
I once tried to code various algorithms on CodeForces in Rust, but seemingly trivial stuff didn't even compile.
I now (I think) understand why, but writing so much code is just confusing.
As before, it would be cool, if you showed how to implement this stuff yourself for even better and deeper understanding.
I also wonder about performance implications: merely traversing a list consisting of (trivial implementation) reference counting smart pointers would cause each pointer-count in the list to be incremented and then decremented.
Nothing better than the good old MS Paint for demonstration XD
Nice explanation. It was smooth like butter
Haha don't sleep on MS Paint
@@letsgetrusty What? I couldn't hear. I was asleep XD
this youtube list is great, because right now im reading the book and if i dont understand something, i come to you.
A great video, as usual. Keep up the good work!
Rust is amazing and so are you 🤩
So, the allocation that a reference counting pointer points at gets released as soon as the strong count goes to 0.. but somehow, the remaining weak references magically know that that has happened. So either a list of them is kept somewhere, and they all get notified/updated (extremely unlikely), or, the reference counting pointer actually points to some kind of separate allocation which is updated. And this separate allocation is Not cleaned up when the strong count goes to zero. Which begs the question - is it ever cleaned up? If so, when? When both the strong and the weak counts go to 0? This also suggests that the high cost of following a pointer to the heap (the potential for a CPU cache miss) is.. something like doubled.. for reference counted pointers.
I really appreciate your videos. Your explanations and examples are super understandable and make learning Rust a lot easier. Thanks for the hard work.
Greetings from Switzerland 👍
Glad to help!
You sure there isn’t a season 2 for pointers only?
jokes
Awesome as always keep up the good work bogdan , also some project vwould be nice to see.
My favorite channel! U r awesome teacher.
Always waiting for the Rust cheechee.
ok it starts hurting
Why is tail() recursive? It seems would only return one-level of Cons.
Amazing painting skill👍🤣
How does that "when parent goes out of scope its children should drop" works when using Weak RC ?
In short, can we say if we have a weak reference, that can be cleared from memory after the scope ends ? Ex : leaf holding the branch as a weak reference, So here branch can be cleared even it getting holder by leaf as a weak reference ... am I correct
Does upgrading weak pointer increases Reference count of Rc Pointer??
Thanks for the video
9:45 this out of context
Shee-shee exetra.
Classic.
It's a very taught chapter....
Classic ending.
Excetra excetra. Chee Chee.
That’s why I’m here.
bro got a new haircut
"When It's dropped, the children should be dropped as well"
This is the part of Rust where I dont understand anymore xD
Too much pointers and I don't see a good reason of using unless you are doing some data structures shit