js new generation garbage collection

Recommended reading: https://www.cnblogs.com/chengxs/p/10919311.html

Clear labeling recovered during the Older Generation before, there will be a new generation garbage collection algorithm execution.

The new generation and the old generation

The so-called new generation, referring to the newly created objects; that is, after the old generation garbage collection also experienced a new generation of "live" down the object.

 

The new generation garbage collection algorithm Scavenge GC

Algorithm is very simple:

1. We maintain a list of the old generation objects each time point to a nascent object when recorded; each deletion point when deleting records. (So ​​we know that the new generation of objects inside, which is the object of a survival)

2. We object to the new generation of memory separate from an average of 2 parts and Space From To 

3. Whenever there is the birth of newborn objects will appear in the From Space

4. Once From space is fully occupied, triggered Scavenge GC

The maintenance of the list, we come up with live objects from the From space, copied to the To space

6. From empty space (this can be achieved without the active object to the recovery off)

7. From To space the roles were reversed, beginning next cycle

Which experienced a recovery of objects that survive, age ++, in Java by default, when age 15 will be promoted to the old generation, JS prescribed age, did not identify bloggers

In another case, when the space when copied to the To, To space has been used by 25%, then the object area directly promoted to older students.

Guess you like

Origin www.cnblogs.com/amiezhang/p/11386644.html