2

Recently we've discovered that our node.js app is most probably having some memory leak (memory consumption showed in htop is growing and growing). We've managed to isolate small amount of code into separate script which is still causing memory leak and now trying to hunt it down. However we're having some troubles with analysing and understanding our test results gathered by htop tool and this v8 profiler: http://github.com/c4milo/node-webkit-agent

Right after script start htop is showing following memory consumption:

http://imageshack.us/a/img844/3151/onqk.png

Then app is running for 5 minutes and I'm taking heap snapshots each 30 secs. After 5 mins results are following:

Heap snapshots sizes:

http://imageshack.us/a/img843/1046/3f7x.png

And results from htop after 5 mins:

http://imageshack.us/a/img33/5339/2nb.png

So if I'm reading this right then V8 profiler shows that there is no serious memory leak, but htop shows that memory consumption grew up from 12MB to 56MB! Can anyone tell where is this difference coming from? And why even at the beginning of tests htop shows 12MB vs 4MB showed by profiler?

Fábio Batista
  • 25,002
  • 3
  • 56
  • 68
agarbund
  • 21
  • 4

1 Answers1

3

htop author here. You're reading the htop numbers right. I don't know about the V8 profiler, but on the issue of "12MB vs 4MB" at the start, it's most likely the case that V8 is accounting only your JS data, while htop accounts the entire resident memory usage of the process, including C libraries used by V8 itself, etc.

Hisham H M
  • 6,398
  • 1
  • 29
  • 30