File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -8,4 +8,8 @@ rustflags = [
88rustflags = [
99 " -C" , " link-arg=-undefined" ,
1010 " -C" , " link-arg=dynamic_lookup" ,
11- ]
11+ ]
12+
13+ # Custom jemalloc conf, ref https://github.com/jemalloc/jemalloc/issues/2688
14+ [env ]
15+ JEMALLOC_SYS_WITH_MALLOC_CONF = " dirty_decay_ms:500,muzzy_decay_ms:-1"
Original file line number Diff line number Diff line change @@ -47,6 +47,18 @@ reqwest = { version = "*", features = ["native-tls-vendored"] }
4747
4848deltalake-mount = { path = " ../crates/mount" }
4949
50+ # Non-unix or emscripten os
51+ [target .'cfg(any(not(target_family = "unix"), target_os = "emscripten"))' .dependencies ]
52+ mimalloc = { version = " 0.1" , default-features = false }
53+
54+ # Unix (excluding macOS & emscripten) → jemalloc
55+ [target .'cfg(all(target_family = "unix", not(target_os = "macos"), not(target_os = "emscripten")))' .dependencies ]
56+ jemallocator = { version = " 0.5" , features = [" disable_initial_exec_tls" , " background_threads" ] }
57+
58+ # macOS → jemalloc (without background_threads) (https://github.com/jemalloc/jemalloc/issues/843)
59+ [target .'cfg(all(target_family = "unix", target_os = "macos"))' .dependencies ]
60+ jemallocator = { version = " 0.5" , features = [" disable_initial_exec_tls" ] }
61+
5062[dependencies .pyo3 ]
5163version = " 0.22.6"
5264features = [" extension-module" , " abi3" , " abi3-py39" , " gil-refs" ]
Original file line number Diff line number Diff line change @@ -79,6 +79,20 @@ use crate::query::PyQueryBuilder;
7979use crate :: schema:: { schema_to_pyobject, Field } ;
8080use crate :: utils:: rt;
8181
82+ #[ cfg( all( target_family = "unix" , not( target_os = "emscripten" ) ) ) ]
83+ use jemallocator:: Jemalloc ;
84+
85+ #[ cfg( all( any( not( target_family = "unix" ) , target_os = "emscripten" ) ) ) ]
86+ use mimalloc:: MiMalloc ;
87+
88+ #[ global_allocator]
89+ #[ cfg( all( target_family = "unix" , not( target_os = "emscripten" ) ) ) ]
90+ static ALLOC : Jemalloc = Jemalloc ;
91+
92+ #[ global_allocator]
93+ #[ cfg( all( any( not( target_family = "unix" ) , target_os = "emscripten" ) ) ) ]
94+ static ALLOC : MiMalloc = MiMalloc ;
95+
8296#[ derive( FromPyObject ) ]
8397enum PartitionFilterValue {
8498 Single ( PyBackedStr ) ,
You can’t perform that action at this time.
0 commit comments