Over a million developers have joined DZone.

Node.js Performance Garbage Collection

· Performance Zone

Evolve your approach to Application Performance Monitoring by adopting five best practices that are outlined and explored in this e-book, brought to you in partnership with BMC.

In another installation of useful node.js/V8 Javascript performance finds, the folks over at the StrongLoop blog  wrote about garbage collection in node.js this week. V8, with built-in garbage collection, has it's benefits and shortcomings:

...you also give up control on memory management, which could be a problem particularly for mobile applications aiming for the optimization of device resources. In particular for JavaScript, the ECMAScript specification doesn’t expose any interface to the garbage collector blocking visibility and forced GC.

Performance wise, it is a wash. In C, allocating (malloc) and freeing objects can be costly, since heap bookkeeping tends to be more complicated. With managed memory, allocation usually means just incrementing a pointer, but  you pay for it eventually when you run out of memory and the garbage collector kicks in.  The fact is that V8  uses garbage collection for better or worse.

They go on to outline how V8 divides the heap into manageable chunks and the processes through which garbage collection is enacted. Check out the post.

Learn tips and best practices for optimizing your capacity management strategy with the Market Guide for Capacity Management, brought to you in partnership with BMC.


Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}