fix: set M_MMAP_THRESHOLD to lower memory usage significantly

This commit is contained in:
Michael Aaron Murphy 2025-02-05 12:51:18 +01:00
parent 22bca8632b
commit ec70edfff8
No known key found for this signature in database
GPG key ID: B2732D4240C9212C

View file

@ -6,5 +6,11 @@ use tikv_jemallocator::Jemalloc;
static GLOBAL: Jemalloc = Jemalloc;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Prevents glibc from hoarding memory via memory fragmentation.
#[cfg(all(not(feature = "jemalloc"), target_env = "gnu"))]
unsafe {
libc::mallopt(libc::M_MMAP_THRESHOLD, 65536);
}
cosmic_files::main()
}