which decreases the reference count of the Rc<List> instance from 2 to 1. The memory that Rc<List> has on the heap won’t be dropped at this point, because its reference count is 1, not 0.
of the rust book
https://doc.rust-lang.org/stable/book/ch15-06-reference-cycles.html
why is the memory saved on Heap it should be on stack right?
no, the data behind the Rc is on the heap
is this the case everytime?
so all atomics based types are also stored on heap?
what do you mean? there's nothing atomic inside Rc, that's why it's Rc and not Arc
wait, we are talking about Rc or about atomic types?
no I was asking Arc, RwLock and Mutex are also stored on heap?
Arc does store its data on the heap, RwLock and Mutex don't
Обсуждают сегодня