Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
CodeRookie262
JavaScript-Algorithm-Training
Repository navigation
Code
Issues
40
(40)
Pull requests
Projects
Security and quality
Insights
More
items
什么是 GC (浏览器垃圾回收机制)?
#22
New issue
Copy link
New issue
Copy link
Open
Open
什么是 GC (浏览器垃圾回收机制)?
#22
Copy link
Labels
浏览器
Description
CodeRookie262
Issue body actions
No description provided.
Activity
CodeRookie262
added
浏览器
on Jan 14, 2021
CodeRookie262 commented
on Jan 15, 2021
CodeRookie262
Owner
Author
More actions
GC浏览器垃圾回收机制也叫做浏览器内存释放机制,
内存主要分为两种: 堆内存和栈内存;
栈内存释放:
加载页面会加载一个全局上下文(这个上下文只有在页面关闭的时候才会被释放)
函数执行会形成一个私有上下文,当函数进栈执行后执行,当函数执行完毕后所形成的私有上下文
一般情况下
会被出栈释放掉以此来优化栈内存空间;
堆内存释放:
堆内存的释放主要分为两种,主要分为「查找引用」(Chrome)和「引用计数」(IE)
标记引用: 浏览器在空闲或者指定时间内查看指定堆内存,吧没有被任何东西占用的堆内存给释放掉,占用的话是不会释放的。
计数引用: 创建一个堆内存,被占用一次浏览器就会计数加一,取消占用则计数减一,当计数的数字为 0 时就会被释放掉,某些情况下回导致计数数据混乱出现"内存泄漏"的现象 (如果想深入了解的小伙伴可以去看高程3最后一章)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Metadata
Metadata
Assignees
No one assigned
Labels
浏览器
Projects
No projects
Milestone
No milestone
Relationships
None yet
Development
No branches or pull requests
Issue actions
Open in GitHub Copilot app
You can’t perform that action at this time.
Activity
CodeRookie262 commentedon Jan 15, 2021
GC浏览器垃圾回收机制也叫做浏览器内存释放机制,
内存主要分为两种: 堆内存和栈内存;
栈内存释放:
堆内存释放:
堆内存的释放主要分为两种,主要分为「查找引用」(Chrome)和「引用计数」(IE)