In order to understand the memory usage pattern of NodeJS's V8 engine, I wrote a simple web program as shown below:
contents of server.js:
var http = require("http");
var server = http.createServer(function(req, res) {
res.write("Hello World");
res.end();
});
server.listen(3000);
When the program is launched using node server.js, the initial memory snapshot is as below:
After I kept making multiple URL hits to this server, I could see a pattern of increased heap usage. To be more precise, for every 6 or 7 hits, there is an increase of 4K. I kept repeating the hits continuously for about 2 minutes, then this is the snapshot.
I didn't see any eventual decrease in heap usage, even if I kept it idle without load.
My question is:
Is this a normal behavior, or there is a memory leak in nodeJS? Or, am I understanding or interpreting it incorrectly?