Skip to content

Commit 4863c58

Browse files
authored
Merge pull request #127 from TG1999/development
Memory leakage tracking issue solved
2 parents 8544698 + 2a309fd commit 4863c58

File tree

7 files changed

+22
-2
lines changed

7 files changed

+22
-2
lines changed

READMEassets/Home.jpg

49.2 KB
Loading

READMEassets/Info.png

187 KB
Loading

READMEassets/about.jpg

74.2 KB
Loading

READMEassets/about2.jpg

34.4 KB
Loading

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"mongodb": "^3.1.0",
2020
"mongoose": "^5.1.7",
2121
"node": "^10.5.0",
22+
"node-memwatch": "^1.0.1",
2223
"nodemon": "^1.18.8",
2324
"passport": "^0.4.0",
2425
"passport-facebook": "^2.1.1",

run.js

Whitespace-only changes.

server.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ const secret=require('./config/credential.js');
1313
const notification = require('./schema/notification.js');
1414
const indexRoutes = require('./routes/index.routes');
1515
const facebook = require('./config/facebook.js');
16+
var memwatch = require('node-memwatch');
17+
//Snapshot at start
18+
var hd = new memwatch.HeapDiff();
1619

1720
mongoose.connect(secret.database, function () {
1821
console.log('connected');
@@ -32,8 +35,24 @@ app.use(passport.initialize());
3235
app.use(passport.session());
3336

3437
app.use(indexRoutes);
35-
36-
38+
//Snapshot after routing
39+
var diff = hd.end();
40+
//Diff between both snapshots
41+
console.log(diff)
42+
//checking for leak in memory
43+
memwatch.on('leak',(info)=>{
44+
for(x in info)
45+
{
46+
console.log(x+':'+info[x]);
47+
}
48+
});
49+
//Stats of memory leakage
50+
memwatch.on('stats',(info)=>{
51+
for(x in info)
52+
{
53+
console.log(x+':'+info[x]);
54+
}
55+
});
3756

3857

3958
var ser = app.listen(3000, function () {

0 commit comments

Comments
 (0)