File tree 1 file changed +3
-4
lines changed
1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,8 @@ unsafe impl GlobalAlloc for System {
9
9
unsafe fn alloc ( & self , layout : Layout ) -> * mut u8 {
10
10
// jemalloc provides alignment less than MIN_ALIGN for small allocations.
11
11
// So only rely on MIN_ALIGN if size >= align.
12
- // Also see <https://github.com/rust-lang/rust/issues/45955>.
12
+ // Also see <https://github.com/rust-lang/rust/issues/45955> and
13
+ // <https://github.com/rust-lang/rust/issues/62251#issuecomment-507580914>.
13
14
if layout. align ( ) <= MIN_ALIGN && layout. align ( ) <= layout. size ( ) {
14
15
libc:: malloc ( layout. size ( ) ) as * mut u8
15
16
} else {
@@ -25,9 +26,7 @@ unsafe impl GlobalAlloc for System {
25
26
26
27
#[ inline]
27
28
unsafe fn alloc_zeroed ( & self , layout : Layout ) -> * mut u8 {
28
- // jemalloc provides alignment less than MIN_ALIGN for small allocations.
29
- // So only rely on MIN_ALIGN if size >= align.
30
- // Also see <https://github.com/rust-lang/rust/issues/45955>.
29
+ // See the comment above in `alloc` for why this check looks the way it does.
31
30
if layout. align ( ) <= MIN_ALIGN && layout. align ( ) <= layout. size ( ) {
32
31
libc:: calloc ( layout. size ( ) , 1 ) as * mut u8
33
32
} else {
You can’t perform that action at this time.
0 commit comments