Skip to content

Chore: Disable jemalloc on Windows#84

Open
hmoog wants to merge 4 commits into
masterfrom
chore/rocksdb-disable-jemalloc-on-windows
Open

Chore: Disable jemalloc on Windows#84
hmoog wants to merge 4 commits into
masterfrom
chore/rocksdb-disable-jemalloc-on-windows

Conversation

@hmoog

@hmoog hmoog commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

The jemalloc feature of the rocksdb crate does not build on Windows, so any
Windows build of the workspace currently fails. This PR makes jemalloc a
non-Windows-only optimization while keeping it enabled everywhere it works
(Linux, macOS), with no change to the allocator behavior on those targets.

This re-implements the idea from @IzioDev's PR #35, adapted to the current
workspace layout (where rocksdb is now consumed by several crates via the
workspace dependency, not just storage/rocksdb-store).

Approach

[workspace.dependencies] cannot be cfg/target-gated, and rocksdb.workspace = true
resolves to a single feature set, so the per-OS split cannot live in the root
manifest. Instead:

  1. The central rocksdb workspace dependency drops jemalloc from its feature
    list, making the shared definition Windows-safe by default.
  2. storage/rocksdb-store keeps rocksdb.workspace = true and re-enables
    jemalloc through a [target.'cfg(not(windows))'.dependencies] block.

Cargo feature unification then turns jemalloc on for the entire non-Windows
build (every crate that depends on rocksdb) and leaves it off on Windows. Only
storage/rocksdb-store needs to opt in; the other rocksdb-using crates are
untouched.

Changes

  • Cargo.toml: remove jemalloc from the central rocksdb workspace
    dependency, with a comment pointing to where it is re-enabled.
  • storage/rocksdb-store/Cargo.toml: add a non-Windows target dependency that
    enables rocksdb's jemalloc feature.
  • storage/README.md: note that jemalloc applies to non-Windows targets.
  • .gitignore: ignore the IDE's target-idea/ build directory.

Behavior

  • Non-Windows (Linux, macOS): identical to before. jemalloc remains enabled for
    the whole build via feature unification.
  • Windows: rocksdb builds without jemalloc, so the workspace compiles.

Testing

  • ./cargo-check-all.sh on a non-Windows host confirms the build still picks up
    jemalloc through unification.
  • Windows compilation should be validated on a Windows runner in CI.

hmoog added 4 commits June 18, 2026 12:42
jemalloc does not build on Windows. Drop it from the central rocksdb
workspace dependency and re-enable it only for non-Windows targets in
storage/rocksdb-store; Cargo feature unification then activates it for
the entire non-Windows build while leaving Windows builds jemalloc-free.

Also gitignore the IDE's target-idea/ build directory so its artifacts
no longer surface as untracked files.
…le-jemalloc-on-windows

# Conflicts:
#	Cargo.toml
@hmoog hmoog marked this pull request as ready for review June 18, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants