We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
FixedSizeAllocator
1 parent 47fad0e commit 13c5783Copy full SHA for 13c5783
crates/oxc_allocator/src/fixed_size.rs
@@ -11,6 +11,7 @@ use crate::{
11
};
12
13
const TWO_GIB: usize = 1 << 31;
14
+const FOUR_GIB: usize = 1 << 32;
15
16
// What we ideally want is an allocation 2 GiB in size, aligned on 4 GiB.
17
// But system allocator on Mac OS refuses allocations with 4 GiB alignment.
@@ -68,7 +69,7 @@ impl FixedSizeAllocator {
68
69
// SAFETY: `offset` is either 0 or `TWO_GIB`.
70
// We allocated 4 GiB of memory, so adding `offset` to `alloc_ptr` is in bounds.
71
let chunk_ptr = unsafe {
- let offset = alloc_ptr.as_ptr() as usize % ALLOC_SIZE;
72
+ let offset = alloc_ptr.as_ptr() as usize % FOUR_GIB;
73
alloc_ptr.add(offset)
74
75
0 commit comments