Skip to content

Commit 2ff9ba4

Browse files
fix[py]: remove mimalloc in library (#7826)
1 parent 115b3ba commit 2ff9ba4

5 files changed

Lines changed: 38 additions & 11 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vortex-python/Cargo.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ default = ["extension-module", "tui"]
2828
# duplicate PyInit__lib symbols.
2929
extension-module = []
3030
tui = ["dep:vortex-tui"]
31-
# Set the default allocator to mimalloc, this is enabled by default
32-
# for the maturin wheels, but it is not a default feature to not conflict
33-
# with users that set a different global allocator.
34-
mimalloc = ["dep:mimalloc"]
3531

3632
[dependencies]
3733
arrow-array = { workspace = true }
@@ -40,7 +36,6 @@ arrow-schema = { workspace = true }
4036
bytes = { workspace = true }
4137
itertools = { workspace = true }
4238
log = { workspace = true }
43-
mimalloc = { workspace = true, optional = true }
4439
object_store = { workspace = true, features = [
4540
"fs",
4641
"aws",

vortex-python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ profile = "release"
6161
editable-profile = "dev"
6262
python-source = "python"
6363
module-name = "vortex._lib"
64-
features = ["pyo3/extension-module", "mimalloc"]
64+
features = ["pyo3/extension-module"]
6565
compatibility = "manylinux2014"
6666
include = [
6767
{ path = "rust-toolchain.toml", format = "sdist" },

vortex-python/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4-
#[cfg(feature = "mimalloc")]
5-
#[global_allocator]
6-
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
7-
84
use std::ops::Deref;
95
use std::sync::LazyLock;
106

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# SPDX-FileCopyrightText: Copyright the Vortex contributors
3+
4+
"""Regression test for https://github.com/vortex-data/vortex/issues/7760.
5+
6+
Importing vortex after pyarrow.dataset must not corrupt pyarrow's runtime.
7+
This test runs in a subprocess because import-order bugs and allocator
8+
conflicts only manifest in a fresh process with specific load ordering.
9+
"""
10+
11+
import subprocess
12+
import sys
13+
14+
import pytest
15+
16+
17+
@pytest.mark.parametrize(
18+
"script",
19+
[
20+
# Issue #7760: pyarrow.dataset before vortex
21+
"import pyarrow.dataset; import vortex; import pyarrow as pa; pa.array([1])",
22+
# Reverse order should also be fine
23+
"import vortex; import pyarrow.dataset; import pyarrow as pa; pa.array([1])",
24+
],
25+
ids=["pyarrow_first", "vortex_first"],
26+
)
27+
def test_import_order_no_crash(script: str) -> None:
28+
result = subprocess.run(
29+
[sys.executable, "-c", script],
30+
capture_output=True,
31+
timeout=30,
32+
)
33+
assert result.returncode == 0, (
34+
f"Process crashed (exit code {result.returncode}).\n"
35+
f"stdout: {result.stdout.decode()}\n"
36+
f"stderr: {result.stderr.decode()}"
37+
)

0 commit comments

Comments
 (0)