Added memwatch for memory leak detection (#10166)

This commit is contained in:
Keith Holliday
2018-03-22 12:44:45 -05:00
committed by Sabe Jones
parent bde8b76da7
commit 25b9e6f330
3 changed files with 19 additions and 2 deletions

12
package-lock.json generated
View File

@@ -2020,8 +2020,7 @@
"bindings": { "bindings": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz", "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz",
"integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw==", "integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw=="
"optional": true
}, },
"bitsyntax": { "bitsyntax": {
"version": "0.0.4", "version": "0.0.4",
@@ -13335,6 +13334,15 @@
"readable-stream": "2.3.4" "readable-stream": "2.3.4"
} }
}, },
"memwatch-next": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/memwatch-next/-/memwatch-next-0.3.0.tgz",
"integrity": "sha1-IREFD5qQbgqi1ypOwPAInHhyb48=",
"requires": {
"bindings": "1.3.0",
"nan": "2.6.2"
}
},
"meow": { "meow": {
"version": "3.7.0", "version": "3.7.0",
"resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz",

View File

@@ -58,6 +58,7 @@
"jquery": ">=3.0.0", "jquery": ">=3.0.0",
"js2xmlparser": "^3.0.0", "js2xmlparser": "^3.0.0",
"lodash": "^4.17.4", "lodash": "^4.17.4",
"memwatch-next": "^0.3.0",
"merge-stream": "^1.0.0", "merge-stream": "^1.0.0",
"method-override": "^2.3.5", "method-override": "^2.3.5",
"moment": "^2.21.0", "moment": "^2.21.0",

View File

@@ -4,6 +4,14 @@ import express from 'express';
import http from 'http'; import http from 'http';
import Bluebird from 'bluebird'; import Bluebird from 'bluebird';
// @TODO: May need to remove - testing
import memwatch from 'memwatch-next';
memwatch.on('leak', (info) => {
const message = `Memory leak detected:\n${info}`;
logger.error(message);
});
global.Promise = Bluebird; global.Promise = Bluebird;
const server = http.createServer(); const server = http.createServer();