I've noticed that RSS (Resident Set Size) of my node.js app is growing over time, and considering I'm having a "JS Object Allocation Failed - Out of Memory" error on my server, it seems a likely cause.
I set up the following very simple Node app:
var express = require('express');
var app = express();
app.get('/',function(req,res,next){
res.end(JSON.stringify(process.memoryUsage()));
});
app.listen(8888);
By simply holding down the "refresh" hotkey @ http:// localhost:8888/ I can watch the RSS/heap/etc. grow, until RSS gets well above 50mb (before I get bored). Waiting a few minutes and coming back, the RSS drops - presumably the GC has run.
I'm trying to figure out if this explains why my actual node app is crashing... my production app quickly hits about 100Mb RSS size, when it crashes it is generally between 200Mb-300Mb. As best as I can tell, this should not be too big (node should be able to handle 1.7Gb or so, I believe), but nonetheless I'm concerned by the fact that the RSS size on my production server trends upwards (falloffs represent crashes):