Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging node.js by webkit-devtools-agent, ways to look at the content of objects in heap?

I am retrying to investigate memory leak problem in my nodejs program by webkit-devtools-agent (https://github.com/c4milo/node-webkit-agent).

By taking heap snapshots, I can see the heap size keeps increasing. But due to complicated structure of my code. It seems that it is not easy to dig out what code generates those objects.

In the profile page, I can only see something like this:

(Array)
[] @28631
[] @31853
(map descriptors)[] @44687
function NativeModule() @35997

Are there ways to find out the content of those objects and the source that generates those object?

I read an article about node.js debugging (http://dtrace.org/blogs/bmc/2012/05/05/debugging-node-js-memory-leaks/). It is quite amazing. But I don't think it is available in linux server, unfortunately.

Thanks!

like image 232
Harold Chan Avatar asked Nov 04 '22 20:11

Harold Chan


1 Answers

You could always try node-inspector. Lucky for you I slapped together an install .gif for node-inspector yesterday to answer a different SO question.

PS - node-inspector runs on all platforms and uses the webkit debugger.

like image 61
Chev Avatar answered Nov 11 '22 04:11

Chev