Похожие чаты

This section The reference count of Rust drops the variable b,

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?

9 ответов

42 просмотра

no, the data behind the Rc is on the heap

// AlenPaulVarghese //- Автор вопроса
// AlenPaulVarghese //- Автор вопроса
Pavlo Myroniuk 🦀
yes

so all atomics based types are also stored on heap?

// AlenPaulVarghese //
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

// AlenPaulVarghese //- Автор вопроса
Artem Starikov
what do you mean? there's nothing atomic inside Rc...

no I was asking Arc, RwLock and Mutex are also stored on heap?

// AlenPaulVarghese //
no I was asking Arc, RwLock and Mutex are also sto...

Arc does store its data on the heap, RwLock and Mutex don't

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта