Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node memwatch: leak of type native

I have a node app that is slowing down with time. Reading that https://hacks.mozilla.org/2012/11/tracking-down-memory-leaks-in-node-js-a-node-js-holiday-season/ it seems that I've a memory leak and the v8 gc is slowing down my app. So I've tried node-memwatch but the relevant result is

 { 
   what: 'Native',
   size_bytes: 18853040,
   size: '17.98 mb',
   '+': 2247,
   '-': 116 
 },

But I don't know what to search in my code base. I think native referers to native v8 functiuns but I'm locked here.

So if we ever have experimented that thank you for your answers.

like image 569
samuel Avatar asked Feb 10 '14 17:02

samuel


1 Answers

As stated in the v8 code comments Native means a "Native object (not from V8 heap)".

Further research led me to this definition:

Native objects are everything else which is not in the JavaScript heap. Native object, in contrast to heap object, is not managed by the V8 garbage collector throughout it’s lifetime, and can only be accessed from JavaScript using its JavaScript wrapper object.

A good thing to notice from the last link is that it mentions Strings can be stored either in the VM heap or in a wrapper object. In its second form these wrappers are created "for accessing external storage where, for example, script sources and other content that is received from the Web is stored".

like image 98
elhoyos Avatar answered Oct 06 '22 07:10

elhoyos