This repository was archived by the owner on Jun 24, 2025. It is now read-only.
This repository was archived by the owner on Jun 24, 2025. It is now read-only.
[Memory Leak] Excessive calls to requireFromString
leads to heap allocation error. #27
Open
Description
Hey!
I've been tracing down a memory leak in my web app for a while now. We use webpack-hot-server-middleware
which consumes this package. Our webapp is quite large and after a certain number of file edits and webpack dev server compilations the app eventually calls it quits.
I've isolated the issue in the following code snippet:
#!/usr/bin/env node
var requireFromString = require('require-from-string');
var cycles = 100000;
var delay = 10;
(function step() {
requireFromString(`/* ${'x'.repeat(10*512*1024)} */`, '/fake/path/to/file.js');
if (--cycles > 0) {
setTimeout(step, delay);
}
}());
I've taken a look at the code in this repo and can't see any thing that jumps out at me. Im hoping that the issue isn't in the "Module" object.
Anything that would help would be appreaciated. Thank you
Metadata
Metadata
Assignees
Labels
No labels