Skip to content

Conversation

@quininer
Copy link
Contributor

Summary

This introduces allocative to debug memory leaks caused by global variables. when enabled, a global variable memory snapshot will be generated each rebuild.

This requires enable the feature at build time using env ALLOCATIVE=1 and specify the output directory at runtime use env RSPACK_ALLOCATIVE_DIR="$DIR".

The output can then be visualized as svg.

to svg: cat allocative.0.flamegraph | inferno-flamegraph > 0.svg
diff: inferno-diff-folded allocative.0.flamegraph allocative.1.flamegraph | inferno-flamegraph > diff0v1.svg

Related links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings October 20, 2025 09:36
@netlify
Copy link

netlify bot commented Oct 20, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit b036650
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/68f762de60d2980008e5b467

@github-actions github-actions bot added release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack. labels Oct 20, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces allocative debugging capabilities to help identify memory leaks caused by global variables. The implementation adds conditional compilation support for allocative features and generates memory snapshots during rebuilds for visualization.

  • Adds allocative dependency and conditional compilation flags across multiple crates
  • Implements memory profiling hooks that generate flamegraph data during compilation rebuilds
  • Enables allocative annotations on key data structures and global static variables

Reviewed Changes

Copilot reviewed 36 out of 37 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
Cargo.toml Adds workspace-level allocative dependency and lint configuration
crates/node_binding/scripts/build.js Adds build-time flag support for enabling allocative features
crates/rspack_core/src/compiler/rebuild.rs Implements memory snapshot generation during rebuild process
Multiple crates/*/Cargo.toml Adds allocative lint configuration to individual crates
Multiple crates//src/.rs Adds allocative derive macros and root annotations to structs and statics

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@quininer quininer force-pushed the debug/impl-allocative branch 3 times, most recently from 3d396ef to 19476a1 Compare October 20, 2025 09:57
@github-actions
Copy link
Contributor

github-actions bot commented Oct 20, 2025

📦 Binary Size-limit

Comparing b036650 to refactor: consolidate ModuleError and ModuleWarning classes (#11935) by neverland

🙈 Size remains the same at 47.73MB

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 20, 2025

CodSpeed Performance Report

Merging #11927 will not alter performance

Comparing debug/impl-allocative (b036650) with main (126822e)

Summary

✅ 17 untouched

@quininer quininer force-pushed the debug/impl-allocative branch 4 times, most recently from 38e6078 to afe209b Compare October 21, 2025 03:01
@quininer quininer force-pushed the debug/impl-allocative branch from afe209b to a517289 Compare October 21, 2025 03:33
@hardfist hardfist force-pushed the debug/impl-allocative branch from a517289 to b036650 Compare October 21, 2025 10:39
@quininer quininer requested a review from hardfist October 22, 2025 04:01
@hardfist hardfist merged commit 628421a into main Oct 22, 2025
48 checks passed
@hardfist hardfist deleted the debug/impl-allocative branch October 22, 2025 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants