Skip to content

Avoid excessive malloc/free #1291

Open
Open

Description

@adsharma

#1286 is fixing a bunch of those. Remaining ones:

  • cached physical plan is cloned on every query. Removing the clone results in segfaults.
  • initializing scan states

Strategy: use uprobes/bpf to get stack traces and remove malloc/memset in the hot path

Activity

  1. adsharma commented on Oct 17, 2026

    @adsharma
    ContributorAuthor

    @zahariash

    Ground truth (uprobes, warm @prrao87 LDBC Q1): main 3,021 → 2,288/exec with everything merged. The remaining ~2,300 break down roughly as:
    per-task operator clones (~150–250, spread across print infos/schemas/evaluators), ValueVector/scan-state setup+teardown (~100),
    txn machinery (~50), FactorizedTable result assembly, ArtKey::encode temps, hash-table builds.

    Attempted and reverted: per-task replica pooling. ProcessorTask::run clones its sink subtree per task (~6 pipelines × subtree).
    Pooling it crashed intermittently (native heap corruption in result strings) — pooled task operators inherit construction-time
    state (TableScanState positions, per-op vectors) that init* doesn't fully reset, and auditing every operator is a bigger, riskier
    project. Reverted cleanly; init hardening stays as its foundation. Details + rationale are on the PR so nobody re-tries it blind.

  2. changed the title [-]avoid excessive malloc/free[/-] [+]Avoid excessive malloc/free[/+] on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions