We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2a044db commit 402ddf1Copy full SHA for 402ddf1
src/uu/sort/src/sort.rs
@@ -123,6 +123,11 @@ const POSITIVE: &u8 = &b'+';
123
// reasonably large chunks for typical workloads.
124
const MIN_AUTOMATIC_BUF_SIZE: usize = 512 * 1024; // 512 KiB
125
const FALLBACK_AUTOMATIC_BUF_SIZE: usize = 32 * 1024 * 1024; // 32 MiB
126
+// On 32-bit systems, use a smaller max buffer (256 MiB) to avoid allocation
127
+// failures due to limited virtual address space.
128
+#[cfg(target_pointer_width = "32")]
129
+const MAX_AUTOMATIC_BUF_SIZE: usize = 256 * 1024 * 1024; // 256 MiB
130
+#[cfg(not(target_pointer_width = "32"))]
131
const MAX_AUTOMATIC_BUF_SIZE: usize = 1024 * 1024 * 1024; // 1 GiB
132
133
#[derive(Debug, Error)]
0 commit comments