Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

fix(allocator): disable jemalloc on Windows

ldm069a5f3a7167d
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index f1fcc954c..9b60f340e 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -205,7 +205,6 @@ jobs:
python scripts/release.py
--version "${{ needs.validate.outputs.version }}"
--expected-target x86_64-pc-windows-msvc
- --no-default-features
- name: Upload Windows artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
diff --git a/docs/RELEASING.md b/docs/RELEASING.md
index 3f95450bb..c23a84330 100644
--- a/docs/RELEASING.md
+++ b/docs/RELEASING.md
@@ -25,9 +25,9 @@ only a staging copy, leaving the binary under `target/release` unchanged for
debugging. Because stripping invalidates a Mach-O signature, macOS staging
binaries are ad-hoc signed again and verified before packaging. They are not
Developer ID signed or notarized. Windows executables are not Authenticode
-signed. The Windows build disables the default `jemalloc` feature and uses the
-system allocator because upstream treats the Windows/MSVC combination as
-untested.
+signed. The allocator behind the default `jemalloc` feature is target-gated
+out on Windows, so Windows builds use the system allocator because upstream
+treats the Windows/MSVC combination as untested.
## Prepare the release
@@ -44,7 +44,7 @@ untested.
Windows PowerShell:
```powershell
- python scripts/release.py --version 0.1.1 --no-default-features
+ python scripts/release.py --version 0.1.1
```
Artifacts are written to `dist/`. The packager rejects a version that does
diff --git a/moli/Cargo.toml b/moli/Cargo.toml
index e10e52495..f93e1ef7f 100644
--- a/moli/Cargo.toml
+++ b/moli/Cargo.toml
@@ -28,12 +28,14 @@ moli-protocol-server = { path = "../moli-protocol-server" }
parking_lot = "0.12"
serde_json = "1.0.145"
tokio = { version = "1.51.0", features = ["macros", "net", "rt-multi-thread", "signal", "sync"] }
-tikv-jemalloc-sys = { version = "0.7.1", optional = true, default-features = false }
-tikv-jemallocator = { version = "0.7.0", optional = true, default-features = false, features = ["override_allocator_on_supported_platforms"] }
tracing = "0.1.41"
tracing-subscriber = { version = "0.3.19", features = ["env-filter", "fmt"] }
url = "2.5.7"
+[target.'cfg(not(target_os = "windows"))'.dependencies]
+tikv-jemalloc-sys = { version = "0.7.1", optional = true, default-features = false }
+tikv-jemallocator = { version = "0.7.0", optional = true, default-features = false, features = ["override_allocator_on_supported_platforms"] }
+
[dev-dependencies]
libc = "0.2"
moli-test-support = { path = "../moli-test-support" }
diff --git a/moli/src/main.rs b/moli/src/main.rs
index 61fd0d328..28918ecb7 100644
--- a/moli/src/main.rs
+++ b/moli/src/main.rs
@@ -6,7 +6,7 @@
use anyhow::Result;
-#[cfg(feature = "jemalloc")]
+#[cfg(all(feature = "jemalloc", not(target_os = "windows")))]
mod allocator;
fn main() -> Result<()> {
diff --git a/scripts/release.py b/scripts/release.py
index 6e1c6c943..615b34957 100755
--- a/scripts/release.py
+++ b/scripts/release.py
@@ -107,10 +107,8 @@ def default_binary_path(target: str) -> Path:
return target_dir / "release" / f"moli{suffix}"
-def build_release(*, no_default_features: bool) -> None:
+def build_release() -> None:
command = ["cargo", "build", "--locked", "--release", "--package", "moli"]
- if no_default_features:
- command.append("--no-default-features")
run_checked(command)
@@ -295,11 +293,6 @@ def parse_args() -> argparse.Namespace:
"--expected-target",
help="fail unless the native rustc host target matches this value",
)
- parser.add_argument(
- "--no-default-features",
- action="store_true",
- help="pass --no-default-features to cargo build",
- )
return parser.parse_args()
@@ -321,7 +314,7 @@ def main() -> int:
)
if not args.skip_build:
- build_release(no_default_features=args.no_default_features)
+ build_release()
binary = (
resolve_repo_path(args.binary)