Merge pull request #789 from pop-os/malloc

fix: set M_MMAP_THRESHOLD to lower memory usage significantly
This commit is contained in:
Jeremy Soller 2025-02-05 07:31:23 -07:00 committed by GitHub
commit b18524e52b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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()
}