the page is excellent !!!
https://dev.to/jennieji/memory-management-in-v8-garbage-collection-and-improvements-18e6
https://v8.dev/blog/concurrent-marking#parallel-marking
The static values like number and string are pushed directly into the Stack memory space in order, while the object value is stored into Heap memory, and its Heap memory address is pushed into the Stack. This is generally how Stack and Heap divide the work.
Scavenge of the minor GC (young generation) The minor GC for the young generation applies a much faster but space consuming algorithm called Scavenge.
It’s space consuming as it makes the young generation space split evenly into a from-space and to-space:
Mark-Sweep The original and naive Mark-Sweep simply traverses the the whole heap graph to mark the objects still alive and then another walk through of the memory space to remove those not alive any more.
And it’s another long long story of how these approaches are implemented. If you are interested in more details, you may read the blog Concurrent Marking.
This approach is called incremental. Sounds familiar? Yes! React Fibre is doing this as well.
However, it has side-effects according to Concurrent Marking: