Skip to content

fix: move join/dirname caches to Resolver instance to prevent memory leak#507

Merged
alexander-akait merged 8 commits intomainfrom
fix/join-cache-memory-leak
Apr 15, 2026
Merged

fix: move join/dirname caches to Resolver instance to prevent memory leak#507
alexander-akait merged 8 commits intomainfrom
fix/join-cache-memory-leak

Conversation

@xiaoxiaojx
Copy link
Copy Markdown
Member

Summary
fixes #414

What kind of change does this PR introduce?
fix

Did you add tests for your changes?
Existing

Does this PR introduce a breaking change?
No

If relevant, what needs to be documented once your changes are merged or what have you already documented?
Nothing

Use of AI
Partial

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 5, 2026

🦋 Changeset detected

Latest commit: 3b0e639

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
enhanced-resolve Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Apr 5, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 5, 2026

Codecov Report

❌ Patch coverage is 96.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.50%. Comparing base (cdae279) to head (3b0e639).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lib/Resolver.js 84.61% 2 Missing ⚠️
lib/TsconfigPathsPlugin.js 95.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #507      +/-   ##
==========================================
+ Coverage   93.42%   93.50%   +0.07%     
==========================================
  Files          50       50              
  Lines        2525     2555      +30     
  Branches      773      779       +6     
==========================================
+ Hits         2359     2389      +30     
  Misses        137      137              
  Partials       29       29              
Flag Coverage Δ
integration 93.50% <96.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@xiaoxiaojx xiaoxiaojx marked this pull request as draft April 5, 2026 12:58
@xiaoxiaojx xiaoxiaojx force-pushed the fix/join-cache-memory-leak branch from 724f707 to fd07044 Compare April 5, 2026 13:12
@xiaoxiaojx xiaoxiaojx marked this pull request as ready for review April 5, 2026 13:35
lib/Resolver.js Outdated
constructor(fileSystem, options) {
this.fileSystem = fileSystem;
this.options = options;
if (options.unsafeCache) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@xiaoxiaojx I think we will have a perf regression here, before we always cache path operations, now we are doing it only when unsafeCache is enabled

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, here I’m thinking of leveraging the unsafeCache option as much as possible. I’ll run the new benchmark just added and see how it performs.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Two performance regressions — I’ll fix them. 😂
image

@xiaoxiaojx xiaoxiaojx force-pushed the fix/join-cache-memory-leak branch from fd07044 to 115db10 Compare April 14, 2026 16:41
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 14, 2026

Merging this PR will improve performance by 31.23%

⚡ 2 improved benchmarks
✅ 41 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
alias-field: browser field (warm) 2 ms 1.5 ms +31.23%
symlinks: follow symlinks=true (warm) 1.8 ms 1.6 ms +12.6%

Comparing fix/join-cache-memory-leak (3b0e639) with main (cdae279)

Open in CodSpeed

@alexander-akait alexander-akait force-pushed the fix/join-cache-memory-leak branch from b6719b2 to ca39d4e Compare April 15, 2026 11:52
@alexander-akait alexander-akait merged commit ba9a8e2 into main Apr 15, 2026
33 of 34 checks passed
@alexander-akait alexander-akait deleted the fix/join-cache-memory-leak branch April 15, 2026 13:42
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.

pathUtils | joinCache memory leak

2 participants