简体   繁体   中英

Memory consumption in Node.js/Express application

My application is running on one Modulus servo with 512 MB of memory. A run of the app looks like this:

模量度

As you can see, the memory rises during execution. But then it stays at 100% indefinitely, even if no further requests are made. I am concerned about the memory consumption of the app on repeated requests.

Is there something that I need to do in my Node.js/Express app to get memory consumption down again after a request finishes?

Currently, I only have this:

process.on("exit", function () {
    'use strict';
    if (mongoose && mongoose.connection) {
        mongoose.connection.close();
    }
});

I think you have memory leak.

Which version of Node.js you are using?

0.12 - Seems to consume more memory.

Check this answers for more,

Detecting memory leaks in nodejs

Tutorial -- https://github.com/felixge/node-memory-leak-tutorial

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM