 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is JavaScript garbage collection?
JavaScript automatically allocates memory, while a variable is declared. Garbage collection finds memory no longer used by the application and releases it since it is of no use. Garbage collector uses algorithms like Mark-and-sweep algorithm, to find the memory no longer used.
This algorithm is used to free memory when an object is unreachable. The garbage collector identifies the objects, which are reachable or unreachable. These unreachable objects get the treatment from the automatic garbage collector.
The Reference-Counting Garbage Collection is also used for garbage collection in JavaScript. The object will get automatically garbage collected if there are no references to it.
Advertisements
 