Please enable JavaScript.
Coggle requires JavaScript to display documents.
memory leak - Coggle Diagram
memory leak
What is GC in node
If a piece of memory segment is not referenced from anywhere, it can be released by GC.
Garbage collection frees up memory in the Heap used by objects that are no longer referenced from the Stack, either directly or indirectly.
-
Because everything in JavaScript is an object this means all dynamic data like arrays, closures, etc. The heap is the biggest block of memory and it’s where Garbage Collection (GC) happens.
-
How to avoid
-
Avoid Accidental Globals
When you assign a value to an undeclared variable, JavaScript automatically “hoists” it.
When you use arrow functions, you also need to be mindful not to create accidental globals
-
-
-
What
-
an orphan block of memory on the Heap that is no longer used by your app because it has not been released by the garbage collector.
-