Node.js memory leak despite constant Heap + RSS sizes

According to my server monitoring, my memory usage creeps over time:

enter image description here

After ~ 4 weeks of uptime, it causes problems / crash (which makes sense, considering that I'm on EC2 with instances of m1.large => 8 GB of RAM, and the RAM seems to increase by about 1.5 GB / week) .

If I restart my node.js application, the memory change will begin. However ... I track my memory usage through process.memoryUsage(), and even after ~ 1 week I see

{"rss":"693 Mb","heapTotal":"120 Mb","heapUsed":"79 Mb"}

What am I missing? Obviously the leak is in node, but the process doesn't seem to know about it ...

+5
source share
1 answer

node-memwatch , , Node.

:

{
  "before": { "nodes": 11625, "size_bytes": 1869904, "size": "1.78 mb" },
  "after":  { "nodes": 21435, "size_bytes": 2119136, "size": "2.02 mb" },
  "change": { "size_bytes": 249232, "size": "243.39 kb", "freed_nodes": 197,
    "allocated_nodes": 10007,
    "details": [
      { "what": "String",
        "size_bytes": -2120,  "size": "-2.07 kb",  "+": 3,    "-": 62
      },
      { "what": "Array",
        "size_bytes": 66687,  "size": "65.13 kb",  "+": 4,    "-": 78
      },
      { "what": "LeakingClass",
        "size_bytes": 239952, "size": "234.33 kb", "+": 9998, "-": 0
      }
    ]
  }
+1

All Articles