Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate ch15-06-reference-cycles.md via GitLocalize #1389

Merged
merged 3 commits into from
May 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rustbook-ru/src/ch15-06-reference-cycles.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

Количество ссылок на экземпляры `Rc<List>` как в `a`, так и в `b` равно 2 после того, как мы заменили список в `a` на ссылку на `b`. В конце `main` Rust уничтожает переменную `b`, что уменьшает количество ссылок на `Rc<List>` из `b` с 2 до 1. Память, которую `Rc<List>` занимает в куче, не будет освобождена в этот момент, потому что количество ссылок на неё равно 1, а не 0. Затем Rust удаляет `a`, что уменьшает количество ссылок экземпляра `Rc<List>` в `a` с 2 до 1. Память этого экземпляра также не может быть освобождена, поскольку другой экземпляр `Rc<List>` по-прежнему ссылается на него. Таким образом, память, выделенная для списка не будет освобождена никогда. Чтобы наглядно представить этот цикл ссылок, мы создали диаграмму на рисунке 15-4.

<img alt="Reference cycle of lists" src="https://github.com/rust-lang-ru/book/blob/master/rustbook-ru/src/img/trpl15-04.svg?raw=true" class="">
<img src="img/trpl15-04.svg" class="center" alt="Reference cycle of lists">

<span class="caption">Рисунок 15-4: Ссылочный цикл списков <code>a</code> и <code>b</code>, указывающих друг на друга</span>

Expand Down
Loading