-
Notifications
You must be signed in to change notification settings - Fork 80
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
Would you recommend this for webpack-dev-server / webpack --watch? #35
Comments
Here's a snippet of code I was running in order to make webpack crash: const fs = require('fs');
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
async function loop() {
let i = 0;
while(true) {
await sleep(3000);
console.log(i);
fs.writeFileSync('sandbox.tpl.html', ++i);
}
}
loop(); |
Thanks for the code-sample, @hrgui :) If this doesn't reproduce without SMP running, then yes - there's probably a memory leak somewhere 🤔 I'll open up the inspector and try and work out where it's leaking from But to clarify - yes, the intended usage is that this plugin should work without issue in watch mode. This is a bug. I've just never tested it over so many saves. |
Cool, so I've managed to reproduce this. A large part of the issue is that wrappedHooks and wrappedObjs never get cleared - which means lots of old build objects are persisting between partial builds. It should be easy enough to wipe these at the end of each partial build - and I can raise a PR for this tonight. I just want to properly look through the memory profiler again, once those 2 arrays are cleared, to ensure there are no other possible leaks we're exposing |
So I've raised #38 to hopefully fix this. I can't see any additional memory leaks, but if you could test it with your set-up and confirm that there isn't any other leak that would be appreciated :) |
Okay, this is now published under v1.2.2 - please re-open if you're still experiencing any issue with this! |
Not sure if related, although I ran into a similar issue with using webpack encore using their
I wrapped it in the way instructed in a previous issue raised #77 I am using
|
I notice with speed-measure-webpack-plugin on, there is a memory leak over time:
Note I have about 2000 modules roughly (file is about 5 mbs)
Test i did was the following on a file:
Memory starts at 977mb, rises all the way to 1.6 gbs after a bunch of saves (so every s above there is a save^), then gives the following error:
The text was updated successfully, but these errors were encountered: