diff --git a/Cargo.lock b/Cargo.lock index a20af45..ce96b94 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -343,6 +343,7 @@ dependencies = [ "datafusion", "datafusion-common", "datafusion-expr", + "mimalloc", "pyo3", "rand 0.7.3", "tokio", @@ -713,6 +714,15 @@ version = "0.2.112" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" +[[package]] +name = "libmimalloc-sys" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7705fc40f6ed493f73584abbb324e74f96b358ff60dfe5659a0f8fc12c590a69" +dependencies = [ + "cc", +] + [[package]] name = "lock_api" version = "0.4.6" @@ -766,6 +776,15 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +[[package]] +name = "mimalloc" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0dfa131390c2f6bdb3242f65ff271fcdaca5ff7b6c08f28398be7f2280e3926" +dependencies = [ + "libmimalloc-sys", +] + [[package]] name = "miniz_oxide" version = "0.4.4" diff --git a/Cargo.toml b/Cargo.toml index bfff3ab..82e9141 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,6 +35,7 @@ datafusion = { version = "^7.0.0", features = ["pyarrow"] } datafusion-expr = { version = "^7.0.0" } datafusion-common = { version = "^7.0.0", features = ["pyarrow"] } uuid = { version = "0.8", features = ["v4"] } +mimalloc = { version = "*", default-features = false } [lib] name = "_internal" diff --git a/src/lib.rs b/src/lib.rs index d40bae2..ab528a1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +use mimalloc::MiMalloc; use pyo3::prelude::*; mod catalog; @@ -27,6 +28,9 @@ mod udaf; mod udf; mod utils; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + /// Low-level DataFusion internal package. /// /// The higher-level public API is defined in pure python files under the