-
-
Notifications
You must be signed in to change notification settings - Fork 734
feat: introduce allocative #11927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: introduce allocative #11927
Conversation
✅ Deploy Preview for rspack canceled.
|
There was a problem hiding this 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.
3d396ef to
19476a1
Compare
📦 Binary Size-limit
🙈 Size remains the same at 47.73MB |
CodSpeed Performance ReportMerging #11927 will not alter performanceComparing Summary
|
19476a1 to
9d0e5be
Compare
38e6078 to
afe209b
Compare
afe209b to
a517289
Compare
a517289 to
b036650
Compare
Summary
This introduces
allocativeto 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=1and specify the output directory at runtime use envRSPACK_ALLOCATIVE_DIR="$DIR".The output can then be visualized as svg.
to svg:
cat allocative.0.flamegraph | inferno-flamegraph > 0.svgdiff:
inferno-diff-folded allocative.0.flamegraph allocative.1.flamegraph | inferno-flamegraph > diff0v1.svgRelated links
Checklist