InterviewSolution
Saved Bookmarks
| 1. |
What is the purpose of garbage collection?(a) Removes object with many reference(b) Removes object with reference(c) Removes object with invalid reference(d) Removes object with no referenceThe question was posed to me by my school principal while I was bunking the class.The doubt is from Performance Navigation and Memory in section Invocation and Performance Navigation of JavaScript |
|
Answer» RIGHT answer is (d) Removes object with no reference Explanation: When the interpreter sees an object in the HEAP with no object references, it removes that object from the heap. This is called garbage collection. An object is considered garbage collectible if there are ZERO references pointing at this object. |
|