Open Galcarmi opened 2 months ago
Oh, it was for cache, how many run do you have?
@alexander-akait The service runs (potentially) infinite bundling processes
I can create a PR for adding a clearCache function, WDYT?
By the way, there is a third option to use LRU cache object with fixed size
@alexander-akait ππΌ
created a fork with the fix https://github.com/webpack/enhanced-resolve/pull/418 i'll try it on my servers and update..
Well, seems like it works, can we do something similar for enhanced-resolve?
Hey guys,
We use webpack in our services to bundle code. A webpack compiler is being created for each bundling process by importing
webpack
creator function fromwebpack
. Webpack is using enhanced-resolve to resolve module paths.. We also have custom resolvers that extendsResolvePluginInstance
which is aenhanced-resolve
resolver AFAIK. Those resolvers are injected to webpack using theplugins
propertyAfter a while, we saw that as the service bundle code a memory leak is increasing in our service. (for each bundle a new compiler of webpack is created)
As you can see in the heap-dump picture, it is related to![Screenshot 2024-04-24 at 15 05 00](https://github.com/webpack/enhanced-resolve/assets/46649273/9303729c-2f76-4647-a8d4-5af60c4f79cf)
joinCache
property.This property can be found here. this is a non-exported global variable that never cleans.
As I can see it, you can help us in 2 ways,
1) Clean this Map every X interval (it will be amazing if you can provide a configuration for it) 2) Provide a function that cleans that cache and we will call it after every bundle process.
LMK if you need any further data/explanations, Thanks ππΌππΌ