diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 000000000000..1f678a632560 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,3 @@ +[env] +# Tune jemalloc (https://github.com/pola-rs/polars/issues/18088). +JEMALLOC_SYS_WITH_MALLOC_CONF = "dirty_decay_ms:500,muzzy_decay_ms:-1" diff --git a/.gitignore b/.gitignore index 4e34b437a91f..3c03000ed764 100644 --- a/.gitignore +++ b/.gitignore @@ -29,7 +29,6 @@ __pycache__/ .coverage # Rust -.cargo/ target/ # Data diff --git a/py-polars/Cargo.toml b/py-polars/Cargo.toml index 7998cf714b81..e911d5c53e77 100644 --- a/py-polars/Cargo.toml +++ b/py-polars/Cargo.toml @@ -113,7 +113,11 @@ built = { version = "0.7", features = ["chrono", "git2", "cargo-lock"], optional [target.'cfg(all(any(not(target_family = "unix"), allocator = "mimalloc"), not(allocator = "default")))'.dependencies] mimalloc = { version = "0.1", default-features = false } -[target.'cfg(all(target_family = "unix", not(allocator = "mimalloc"), not(allocator = "default")))'.dependencies] +# Feature background_threads is unsupported on MacOS (https://github.com/jemalloc/jemalloc/issues/843). +[target.'cfg(all(target_family = "unix", not(target_os = "macos"), not(allocator = "mimalloc"), not(allocator = "default")))'.dependencies] +jemallocator = { version = "0.5", features = ["disable_initial_exec_tls", "background_threads"] } + +[target.'cfg(all(target_family = "unix", target_os = "macos", not(allocator = "mimalloc"), not(allocator = "default")))'.dependencies] jemallocator = { version = "0.5", features = ["disable_initial_exec_tls"] } [features]