mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-01-24 22:32:56 +02:00
Update arc.md (#255)
Adding more information about `Arc`: what it stands for, costs and that reference cycles can occur.
This commit is contained in:
parent
8107a0ea2b
commit
dc894b1e9d
@ -23,3 +23,12 @@ fn main() {
|
||||
```
|
||||
|
||||
[1]: https://doc.rust-lang.org/std/sync/struct.Arc.html
|
||||
|
||||
<details>
|
||||
|
||||
* `Arc` stands for "Atomic Reference Counted", a thread safe version of `Rc` that uses atomic operations.
|
||||
* `Arc::clone()` has the cost of atomic operations that get executed, but after that the use of the `T` is free.
|
||||
* Beware of reference cycles, Rust does not have a garbage collector to detect those.
|
||||
* `std::sync::Weak` can help.
|
||||
|
||||
</details>
|
||||
|
Loading…
x
Reference in New Issue
Block a user