当前位置:网站首页>Yyds dry inventory brief chrome V8 engine garbage collection
Yyds dry inventory brief chrome V8 engine garbage collection
2022-06-27 16:12:00 【51CTO】
V8 It is a more mainstream at present JavaScript Execution engine , Using just in time compilation , It's very fast .V8 Your memory is limited , such as 64 The upper limit of bit operating system is 1.4T, The lower limit is 700M,32 The upper and lower limits of the bit operating system are 64M and 32M.
V8 Adopt the garbage collection strategy of generational recycling , Memory is divided into new generation and old generation , Different corresponding algorithms are used for different objects .
Above, V8 Memory allocation diagram of , You can see V8 Memory space is divided into two parts . Sinister from and to It's the new generation , It takes up less space (32M|16M), The Cenozoic here refers to the storage area with short survival time . The red part on the right is the older generation storage area with longer survival time .
V8 frequently-used GC The algorithm has the following 5 Kind of :
- Generational recycling
- Space replication
- Mark clear
- Tag to sort out
- Mark increment
Among them, the new generation adopts replication algorithm and label sorting for garbage collection , Older generations use markers to clear 、 Mark up and incremental mark up for garbage collection .
V8 New generation object recycling implementation
The picture above shows V8 Implementation diagram of new generation object recycling , The combination of replication algorithm and tag sorting is used for garbage collection . Two equal spaces of the Cenozoic memory area ,From Represents the space used to store active objects ,To Represents free space .V8 The new generation of object recycling is to copy the objects to... After finishing the sorting through marking To, And then To and From Space exchange , And free up the space occupied by the sorted useless objects . It should be noted that , Copying grooming objects to To There may be a promotion . Promotion refers to moving new generation objects to older generation storage . There are usually two conditions for promotion , One is a round of GC The new generation of objects who are still alive can be promoted , The second is To The utilization rate of space exceeds 25%.
V8 Old generation object recycling implementation
V8 The recycling process of the old generation adopts mark removal 、 The combination of mark sorting and mark increment . Generally, when garbage collection is carried out, the garbage space will be recycled through mark removal , But when the new generation moves to the old generation , And when the older generation doesn't have enough memory , Then the space will be optimized through tag sorting , And use incremental markers to optimize efficiency .
Mark increment is actually a method of marking the mark operation , Make the schedule reasonable . This sentence may be a little windy , Simply put, in garbage collection , Let the marking system distinguish different time periods when marking , Mark and execute respectively , Let the two operations be separated , To optimize the timing , This will make the page feel smoother .
边栏推荐
猜你喜欢

智慧风电 | 图扑软件数字孪生风机设备,3D 可视化智能运维

Four characteristics of transactions

Numerical extension of 27es6

Bit. Store: long bear market, stable stacking products may become the main theme

What is the level 3 password complexity of ISO? How often is it replaced?

分布式Session解决方案

【Pygame小游戏】这款“吃掉一切”游戏简直奇葩了?通通都吃掉嘛?(附源码免费领)

一场分销裂变活动,不止是发发朋友圈这么简单!

Mobile terminal click penetration

The latest development course of grain college in 2022: 8 - foreground login function
随机推荐
特殊函数计算器
About tensorflow using GPU acceleration
【Pygame小遊戲】這款“吃掉一切”遊戲簡直奇葩了?通通都吃掉嘛?(附源碼免費領)
洛谷入门1【顺序结构】题单题解
泰山OFFICE技术讲座:第一难点是竖向定位
Luogu_ P1003 [noip2011 improvement group] carpet laying_ Violence enumeration
分布式Session解决方案
#yyds干货盘点# 解决剑指offer:二叉树中和为某一值的路径(三)
Introduce you to ldbc SNB, a powerful tool for database performance and scenario testing
Create a database and use
Nemo of pulseaudio (22)
[170] the PostgreSQL 10 field type is changed from string to integer, and the error column cannot be cast automatically to type integer is reported
Scrapy framework (I): basic use
Source NAT address translation and server mapping web page configuration of firewall Foundation
Eolink 推出面向中小企业及初创企业支持计划,为企业赋能!
3.4 fixed number of cycles II
Four characteristics of transactions
Openssf security plan: SBOM will drive software supply chain security
[pygame Games] ce jeu "eat Everything" est fantastique? Tu manges tout? (avec code source gratuit)
鸿蒙发力!HDD杭州站·线下沙龙邀您共建生态