
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
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.
- Related Articles
- Garbage collection(GC) in JavaScript?
- What is garbage collection in C#?
- Java Garbage collection
- Garbage collection in Java
- Garbage Collection in Python
- Explain in detail about Reference-counting garbage collection in JavaScript?
- Destroying Objects (Garbage Collection) in Python
- Destructors and Garbage Collection in Perl
- What is garbage? What does garbage consist of?
- How to force garbage collection in C#?
- How does garbage collection work in Python?
- What is garbage?
- When are python objects candidates for garbage collection?
- Using the finalize() method in Java Garbage Collection
- How does Garbage Collection work in Lua Programming?

Advertisements