File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ - Start Date: 2014-03-28
2
+ - RFC PR #:
3
+ - Rust Issue #:
4
+
5
+ # Summary
6
+
7
+ I propose removing support for weak pointers from ` Rc<T> ` , and adding it to a
8
+ separate type ` WRc<T> ` .
9
+
10
+ # Motivation
11
+
12
+ ` Rc<T> ` currently uses two words for reference counting, to support an
13
+ infrequently used feature - weak pointers. A search of the rust and servo
14
+ codebases show zero uses of weak pointers, and the vast majority of reference
15
+ counted code does not create cycles. However, outside of the spirit of not
16
+ paying for what you don't use, every single ` Rc<T> ` keeps an extra word,
17
+ the weak count, than it needs to.
18
+
19
+ Hopefully this will help decrease the memory usage of rustc after all of the
20
+ managed boxes get turned into ` Rc<T> ` s.
21
+
22
+ # Detailed design
23
+
24
+ I just want to rename ` Rc<T> ` to ` WRc<T> ` , and create a similar datastructure
25
+ with its old name ` Rc<T> ` which just does not have a weak count. It will
26
+ support all of the same operations except for downgrading.
27
+
28
+ A similar transformation will also be done on ` ARc<T> ` , with a renaming to
29
+ ` AWRc<T> ` .
30
+
31
+ # Alternatives
32
+
33
+ Of course, we could do nothing. That's fine, but using all this memory for no
34
+ good reason is kind of unfortunate.
35
+
36
+ # Unresolved questions
37
+
38
+ Bikeshedding over the naming.
You can’t perform that action at this time.
0 commit comments