Skip to content

Commit a88f0b2

Browse files
committed
Updated heap/sack size comparison
1 parent 2e94195 commit a88f0b2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Finally, because this library uses no global state (beyond the standard allocato
121121

122122
## Comparison spreadsheet
123123

124-
In this comparison spreadsheet, the raw pointer `T*` is assumed to never be owning, and used only to observe an existing object (which may or may not have been deleted). The stack and heap sizes were measured with gcc 9.3.0 and libstdc++.
124+
In this comparison spreadsheet, the raw pointer `T*` is assumed to never be owning, and used only to observe an existing object (which may or may not have been deleted). Unless otherwise specified, the stack and heap sizes were measured with gcc 9.4.0 and libstdc++-9.
125125

126126
Labels:
127127
- raw: `T*`
@@ -146,7 +146,7 @@ Labels:
146146
| Number of heap alloc. | 0 | 0 | 0 | 1 | 1/2(4) | 2 | 1 |
147147
| Size in bytes (64 bit) | | | | | | | |
148148
| - Stack (per instance) | 8 | 16 | 16 | 8 | 16 | 16 | 16 |
149-
| - Heap (shared) | 0 | 0 | 0 | 0 | 24 | 4 | 4 |
149+
| - Heap (shared) | 0 | 0 | 0 | 0 | 24(5) | 4 | 4(6) |
150150
| - Total | 8 | 16 | 16 | 8 | 40 | 20 | 20 |
151151
| Size in bytes (32 bit) | | | | | | | |
152152
| - Stack (per instance) | 4 | 8 | 8 | 4 | 8 | 8 | 8 |
@@ -159,6 +159,8 @@ Notes:
159159
- (2) Not if using `std::make_shared()`.
160160
- (3) Not defined by the C++ standard. In practice, libstdc++ stores its reference count on an `_Atomic_word`, which for a common 64bit linux platform is a 4 byte signed integer, hence the limit will be 2^31 - 1. Microsoft's STL uses `_Atomic_counter_t`, which for a 64bit Windows platform is 4 bytes unsigned integer, hence the limit will be 2^32 - 1.
161161
- (4) 2 by default, or 1 if using `std::make_shared()`.
162+
- (5) When using `std::make_shared()`, this can get as low as 16 bytes, or larger than 24 bytes, depending on the size and alignment requirements of the object type. This behavior is shared by libstdc++ and MS-STL.
163+
- (6) Can get larger than 4 depending on the alignment requirements of the object type.
162164

163165

164166
## Speed benchmarks

0 commit comments

Comments
 (0)