Skip to content

Wave-33 C00: optional jemalloc feature (soft) - #277

Merged
KooshaPari merged 1 commit into
mainfrom
feat/sl-w33-c00-jemalloc-soft
Jul 14, 2026
Merged

Wave-33 C00: optional jemalloc feature (soft)#277
KooshaPari merged 1 commit into
mainfrom
feat/sl-w33-c00-jemalloc-soft

Conversation

@KooshaPari

Copy link
Copy Markdown
Owner

Summary

  • Add optional jemalloc Cargo feature for sl-daemon using tikv-jemallocator (Unix-only #[global_allocator]); default/Windows builds unchanged on the system allocator
  • Document contract in docs/ops/jemalloc.md with hermetic SelfCheck (scripts/jemalloc-check.ps1 + tests/jemalloc_soft.rs)
  • Soft CI: jemalloc job in ops-load.yml (continue-on-error) builds --features jemalloc on Ubuntu

Test plan

  • pwsh ./scripts/jemalloc-check.ps1 -SelfCheck
  • cargo test --test jemalloc_soft --locked
  • cargo build --locked (default, Windows)
  • cargo check --features jemalloc --locked (Windows no-op for allocator; feature resolves)
  • Soft CI ops-load jemalloc job on Ubuntu

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@KooshaPari, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c350c98c-a386-4d7c-8ca2-000403e0128a

📥 Commits

Reviewing files that changed from the base of the PR and between 6259c69 and c75fe39.

⛔ Files ignored due to path filters (1)
  • crates/sl-daemon/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • .env.example
  • .github/workflows/ops-load.yml
  • crates/sl-daemon/Cargo.toml
  • crates/sl-daemon/README.md
  • crates/sl-daemon/src/main.rs
  • docs/ops/alloc-profile.md
  • docs/ops/jemalloc.md
  • docs/ops/runbook.md
  • scripts/jemalloc-check.ps1
  • tests/jemalloc_soft.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/sl-w33-c00-jemalloc-soft
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feat/sl-w33-c00-jemalloc-soft

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@socket-security

socket-security Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcargo/​tikv-jemallocator@​0.6.110010093100100

View full report

Gate tikv-jemallocator behind --features jemalloc (Unix-only) so default and Windows builds keep the system allocator; add SelfCheck docs and soft ops-load CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
@KooshaPari
KooshaPari force-pushed the feat/sl-w33-c00-jemalloc-soft branch from abd4a92 to c75fe39 Compare July 14, 2026 12:25
@KooshaPari
KooshaPari merged commit 18486e8 into main Jul 14, 2026
55 of 56 checks passed
otel-metrics = []
# Soft optional jemalloc global allocator (Unix). Default builds stay on the
# system allocator — Windows-safe / unchanged. Enable: --features jemalloc
jemalloc = ["dep:tikv-jemallocator"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: jemalloc feature references a cfg(unix)-only optional dependency via dep:

jemalloc = ["dep:tikv-jemallocator"] points at a dependency declared solely under [target.'cfg(unix)'.dependencies]. On non-Unix targets the dependency does not exist, so this dep: reference is inert there. Modern Cargo resolves this fine (you confirmed cargo check --features jemalloc works on Windows), but please verify the repo's standard cargo test --all-features loop on Windows still resolves — --all-features also enables jemalloc, and some Cargo versions error with "feature includes dep:, but is not a dependency for target ..." for target-specific optional deps. If it ever breaks, gate the feature behind a cfg(unix) resolver or make the optional dep unconditional (non-target) optional.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

}
[void](Write-Check -Label "jemalloc not in default features" -Ok $true)

if ($mainRs -notmatch 'cfg\(all\(feature = "jemalloc", unix\)\)') {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: cfg gate check is argument-order sensitive

The regex cfg\(all\(feature = "jemalloc", unix\)\) only matches that exact argument order. A functionally equivalent reorder such as cfg(all(unix, feature = "jemalloc")) (or a future refactor that wraps the gate) would fail the SelfCheck and break the soft test even though the allocator is still correctly Unix+feature gated. Consider asserting both conditions independently — e.g. match feature = "jemalloc" and unix inside a cfg(all(...)) — so reordering does not regress the check.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

Code Review Summary

Status: 2 Issues Found (all non-blocking) | Recommendation: Merge with optional follow-ups

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
crates/sl-daemon/Cargo.toml 75 jemalloc feature targets a cfg(unix)-only optional dep via dep:; verify --all-features Windows resolution
scripts/jemalloc-check.ps1 125 cfg gate regex is argument-order sensitive
Consider (non-line)
  • .github/workflows/ops-load.yml jemalloc job: Swatinem/rust-cache populates the default target/ dir, but jemalloc-check.ps1 -Build sets CARGO_TARGET_DIR=target-w33-c00-jemalloc when unset, so CI's cache is not reused and the soft build recompiles from scratch. Low impact (soft, continue-on-error).
Files Reviewed (11 files)
  • .env.example
  • .github/workflows/ops-load.yml
  • crates/sl-daemon/Cargo.toml
  • crates/sl-daemon/README.md
  • crates/sl-daemon/src/main.rs
  • docs/ops/alloc-profile.md
  • docs/ops/jemalloc.md
  • docs/ops/runbook.md
  • scripts/jemalloc-check.ps1
  • tests/jemalloc_soft.rs
  • crates/sl-daemon/Cargo.lock (generated — not reviewed)

Fix these issues in Kilo Cloud


Reviewed by hy3:free · Input: 93.5K · Output: 18.5K · Cached: 227K

@KooshaPari
KooshaPari deleted the feat/sl-w33-c00-jemalloc-soft branch August 12, 2026 08:59
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.

1 participant