Hi folks,

What's the best way to do heap profiling of JavaScript code in Nashorn? We're 
running a large JavaScript framework on Nashorn, and recently I had to track 
down a couple memory leaks. This turned out to be a painful process. When using 
a heap profiler like YourKit, it's very tedious to find the correspondence 
between what you see in a JVM retention path and the exact JavaScript code it 
originates from: there are multiple layers of JVM representation, and the 
naming is a bit cryptic.

Eventually I fell back on a manual process of drilling down to the "JO* -> map 
-> properties -> list" linked list to find a unique property name within each 
JavaScript object, and used what I found there to grep the JavaScript code. The 
situation is better if you happen to come upon a closure, because the "data -> 
functionName" property in ScriptFunctionImpl includes a line number. But it 
seems like there must be a better way.

Any guidance would be much appreciated.


Thanks,

jf

Reply via email to