Skip to content

Memory leak on watcher dispose #417

Closed
@Llorx

Description

@Llorx

When I run this code:

var i = 0;
var webpack = require("webpack");
function c() {
    var compiler = webpack({
        context: __dirname,
        entry: "./main3.ts",
        output: {
            filename: 'bundle.js',
            path: '/'
        },
        resolve: {
            extensions: ["", ".webpack.js", ".web.js", ".ts", ".tsx", ".js"]
        },
        module: {
            loaders: [{
                test: /\.tsx?$/,
                loader: "ts-loader"
            }],
        }
    });
    compiler.plugin("compile", () => {
        console.log("cmp", i++);
    });
    return compiler.watch({
        aggregateTimeout: 333
    }, (err, stats) => {
        setTimeout(() => {
            oldc.close();
            oldc = c();
        }, 33);
    });
}
oldc = c();

Having as main3.ts contents simply a bunch of console.log (about 10k, for testing), without any dependencies of anything, after some time I get a "process out of memory" error.

Don't happens if I change the main3.ts extension to js (so the loader is not used) and also don't happens with awesome-typescript-loader (you see the memory going up and down, instead of all the way up), so I guess is a ts-loader problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions