Skip to content
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

fix: use the process cache to reduce the memory for asar file #36598

Closed
wants to merge 4 commits into from

Conversation

xuwanghu
Copy link
Contributor

@xuwanghu xuwanghu commented Dec 7, 2022

Description of Change

The memory leaks at /lib/asar/fs-wrapper.ts, const cachedArchives = new Map<string, NodeJS.AsarArchive>() Whenever a new worker is created, it will have an instance of this map. The contents of this map will not be cleaned up immediately.
And there is a process-level cache at /shell/common/asar/asar_util.cc, static base::NoDestructor<ArchiveMap> s_archive_map
In summary, I decide to use this process-level cache to save the asar cache instead of creating a new one for each worker

Checklist

  • PR description included and stakeholders cc'd
  • npm test passes

Release Notes

Notes: use the process cache to reduce the memory for asar file

@welcome
Copy link

welcome bot commented Dec 7, 2022

💖 Thanks for opening this pull request! 💖

We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix.

Examples of commit messages with semantic prefixes:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add app.isPackaged() method
  • docs: app.isDefaultProtocolClient is now available on Linux

Things that will help get your PR across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Dec 7, 2022
@xuwanghu xuwanghu closed this Dec 7, 2022
@xuwanghu xuwanghu deleted the bugfix/36597 branch December 7, 2022 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-pr 🌱 PR opened in the last 24 hours
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants