-
-
Notifications
You must be signed in to change notification settings - Fork 383
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
Memory leak caused by ChunkExtractor #560
Comments
Hey @floric 👋, |
Yes, it is a memory leak, hopefully only in dev - here loadable-components/packages/server/src/util.js Lines 3 to 6 in 4e99a97
The module cache got cleared, so file could be required again, but it does not clean reference from the parent module, so there is more and more copies stored in the "parent module" (which is Open questions:
|
"Great" :) I'm not sure about the correct way yet. I don't use HMD but reloading the server with Webpack in watch mode together with Nodemon and Somehow I'm confused that there is an ENV check. I thought it should already be executed with |
fix: memory leak in module cache management, fixes #560
🐛 Bug Report
Server side rendering in combination with specifying the stats file path for the ChunkExtractor seems to cause a memory leak. It might be in connection with streaming the response, but I'm not sure about this yet. Lucky wise I found a better solution and think we should adapt the documentation to preload the file only once anyway. Whats the point of loading it for every request again? Do you agree and maybe know the issue of the memory leak?
To Reproduce
Example for Fastify:
Expected behavior
ChunkExtractor loads stats and releases all allocated memory after response is completed.
Used solution
I was able to solve it in my case by simply loading the file once during startup. If the file otherwise gets loaded for every request, then the examples and documentation should also be changed, as it will decrease performance and doesn't seem to be necessary:
Link to repl or repo
Unfortunately, this is private project. But as I already found a better solution, I just like to inform you in case you might be aware of the underlying issue.
System:
Binaries:
npmPackages:
The text was updated successfully, but these errors were encountered: