← Back to Pull requests

feat: add a jemalloc Maven profile to build Comet with the jemalloc allocator #7356

Open
unknown opened this pull request with 322 lines diff across 4 files
View on GitHub
unknown unknown commented on Oct 30, 2026 22:56 UTC
Author

Which issue does this PR close?

Related to #7344 and #7108. Both stay open.

Rationale for this change

glibc keeps freed native memory resident in long-running executors (#7108). The jemalloc Cargo feature exists, but there is no documented way to build Comet with it and no CI run that tests it, so it cannot easily be compared with glibc (#7344). This PR adds a jemalloc Maven profile that builds Comet with jemalloc. The published jars are unchanged and keep the system allocator.

What changes are included in this PR?

flowchart TB
    subgraph build["make release PROFILES=... -Pjemalloc"]
        F["Makefile sees jemalloc in PROFILES"] --> C["cargo build --release --features jemalloc"]
        C --> L["native/target/release/libcomet.so<br/>built with jemalloc"]
        L --> J["Comet jar with that one native library"]
        P["Maven -Pjemalloc<br/>sets comet.jemalloc=true for the tests"] --> J
    end

    subgraph load["Driver or executor JVM"]
        N["NativeBase loads libcomet.so"] --> G["INFO: Comet native library uses<br/>the jemalloc allocator"]
    end

    J --> N

    subgraph ci["CI with the run-jemalloc-tests label"]
        CB["cargo build --profile ci --features jemalloc"] --> T["Linux suites run with -Pjemalloc"]
        T --> A["the test fails unless the loaded<br/>library uses jemalloc"]
    end

  • A jemalloc profile in the root pom.xml. Maven does not build the native library, so make adds the jemalloc Cargo feature whenever PROFILES names the profile, for example make release PROFILES="-Pspark-4.1 -Pjemalloc". make release-nogit now passes COMET_FEATURES too.

  • The profile passes comet.jemalloc=true to the tests, and a test in CometSparkSessionExtensionsSuite checks that the loaded native library uses jemalloc. NativeBase logs which allocator the loaded library uses.

  • CI: the run-jemalloc-tests label builds the pull request's native library with jemalloc and runs its Linux suites with -Pjemalloc, for pull requests into main only. Every other run tests the default build.

  • Docs: a "Building with the jemalloc allocator" section in the build-from-source guide, covering _RJEM_MALLOC_CONF and 64 KiB-page arm64 kernels.
  • How are these changes tested?

    The new test fails a -Pjemalloc build whose native library does not use jemalloc, and the run-jemalloc-tests label runs it in CI. Checked locally: the offline compile with -Pjemalloc, spotless and scalastyle, the Spark 3.5 strict warnings build, dev/ci/check-ci-config.py, actionlint, and make -n.

    Diff: 322 lines (+241 / -81) across 4 files Reviewer: andygrove Review duration: 6262m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.42) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 322 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.346
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #7356"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 41.9% (MEDIUM) · Higher = larger blast radius
    41.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.4% · Safe to merge
    22.4%