Detecting memory leaks
Memory leaks can have a severe impact on the performance of your application, and in some cases, can even cause your application to crash.
V8 stores objects and dynamic data in its heap, where a heap is a binary tree-based data structure that is geared toward organizing direct relationships between parent and child nodes. The V8 Garbage Collector (GC) is responsible for managing the heap. The V8 GC reclaims any memory that is no longer in use – freeing the memory so that it can be reused.
A memory leak occurs when a block of memory is never reclaimed by the GC and is therefore idle and inefficient. This results in pieces of unused memory remaining on the heap. The performance of your application can be impacted when many of these unused memory blocks accumulate in the heap. In the worst cases, the unused memory could hog all of the available heap space, which in turn can cause your application to crash.
In this recipe, we'll learn how to...