diff options
| author | bors <bors@rust-lang.org> | 2018-06-29 04:09:02 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-06-29 04:09:02 +0000 |
| commit | 3b50455c61847c4a417b5fb002a5258dbaf4a868 (patch) | |
| tree | 38bb73d53a70ba02f37d41a922644f61cf735936 /src/libstd/thread | |
| parent | 775ce974979dc180c127bf0fb4ad9cab382d16ef (diff) | |
| parent | 24ce2597823640726aa302a12a4de787a1fe1f05 (diff) | |
| download | rust-3b50455c61847c4a417b5fb002a5258dbaf4a868.tar.gz rust-3b50455c61847c4a417b5fb002a5258dbaf4a868.zip | |
Auto merge of #50357 - seanmonstar:arc-weak-null, r=KodrAus
Arc: remove unused allocation from Weak::new() It seems non-obvious that calling `Weak::new()` actually allocates space for the entire size of `T`, even though you can **never** access that data from such a constructed weak pointer. Besides that, if someone were to create many `Weak:new()`s, they could be unknowingly wasting a bunch of memory. This change makes it so that `Weak::new()` allocates no memory at all. Instead, it is created with a null pointer. The only things done with a `Weak` are trying to upgrade, cloning, and dropping, meaning there are very few places that the code actually needs to check if the pointer is null.
Diffstat (limited to 'src/libstd/thread')
0 files changed, 0 insertions, 0 deletions
