Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
javascriptのGC入門
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Taketoshi Aono(青野健利 a.k.a brn)
June 07, 2017
Programming
2
150
javascriptのGC入門
javascriptのGCの特徴やどのように動作するかの解説
Taketoshi Aono(青野健利 a.k.a brn)
June 07, 2017
Tweet
Share
More Decks by Taketoshi Aono(青野健利 a.k.a brn)
See All by Taketoshi Aono(青野健利 a.k.a brn)
document.write再考
brn
6
3.1k
Parsing Javascript
brn
14
9.4k
JSON & Object Tips
brn
1
540
CA 1Day Youth Bootcamp for Frontend LT
brn
0
1k
Modern TypeScript
brn
2
850
javascript - behind the scene
brn
3
790
tc39 proposals
brn
0
940
プロダクト開発とTypeScript
brn
8
3k
React-Springでリッチなアニメーション
brn
1
750
Other Decks in Programming
See All in Programming
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
170
AWS re:Invent 2025参加 直前 Seattle-Tacoma Airport(SEA)におけるハードウェア紛失インシデントLT
tetutetu214
2
100
ThorVG Viewer In VS Code
nors
0
760
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
Kotlin Multiplatform Meetup - Compose Multiplatform 외부 의존성 아키텍처 설계부터 운영까지
wisemuji
0
190
Fluid Templating in TYPO3 14
s2b
0
130
Patterns of Patterns
denyspoltorak
0
1.4k
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.8k
QAフローを最適化し、品質水準を満たしながらリリースまでの期間を最短化する #RSGT2026
shibayu36
2
4.3k
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
160
CSC307 Lecture 01
javiergs
PRO
0
690
Featured
See All Featured
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
0
1.1k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.6k
Git: the NoSQL Database
bkeepers
PRO
432
66k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
77
Making the Leap to Tech Lead
cromwellryan
135
9.7k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Making Projects Easy
brettharned
120
6.6k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
63
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
200
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
280
Music & Morning Musume
bryan
47
7.1k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.7k
Transcript
javascript Garbage Collector Overview
せ: @brn (ꫬꅿ⨳ⵃ) 耵噟: ؿٗٝزؒٝسؒٝآص،٥iOSؒٝآص، ⠓爡: Cyberagent ،سذؙأةآؔRightSegment٥AI Messenger ـؚٗ:
http://abcdef.gets.b6n.ch/
What is Garbage Collector? Garbage Collectorהכծفؚٗٓي⚥חⶴ䔲גؔـآؙؑزך 灶唱遤ְծًٌٔ걄㚖然⥂׃湫ׅךկ
What is Garbage Collector? var x = { a: 1,
b: 2 } Object Field a Field b Other Objects Heap ًٌٔⶴ䔲ג
What is Heap? Stack ꟼ侧 = ⠓陽 Heap مٙ؎زن٦س 陽✲ꐮ
What is Heap? Stackכꟼ侧⽃⡘דⶴ䔲גծꟼ侧ָ穄✪ׅה荈⹛ד灶唱ׁג׃ת ֲկ Heapכفؚٗٓيָ㶷㖈׃גְכ䌢ח⦼⥂㶷׃גֶֽկ javascriptכ䌢חHeapח⦼ⶴ䔲ג♳ծStackכ湫䱸ׁזְךדծ 罋ִ䗳銲כזְկ
What is Heap? Stack Process Stack Heap Process Stack Heap
Process 饯⹛儗 㹋遤⚥ 㹋遤⚥(㣐ꆀⶴ䔲ג)
What is Heap? OUT OF MEMORY
Garbage Collector 㟓ִֺׅHeapכ铩ַָ䰾ꤐ׃זֽלְֽזְկ ׃גֻךָ Garbage Collector
Garbage Collector ًٌٔⶴ䔲ג var x = {} var y
= {} Heap Global x y
Garbage Collector Garbage CollectorָHeapךⵋ麦〳腉זؔـآؙؑزחو٦ؙ➰ֽ Heap Global x y
Garbage Collector ًٌٔⶴ䔲ג var x = {} var y
= {} y = null Heap Global x y
Garbage Collector Garbage CollectorָHeapךⵋ麦〳腉זؔـآؙؑزחو٦ؙ➰ֽ Heap Global x y
Garbage Collector ًٌٔⶴ䔲ג var x = {}; var y
= {x: x}; x = null y.x = null Heap Global x y
Garbage Collector Garbage CollectorָHeapךⵋ麦〳腉זؔـآؙؑزחو٦ؙ➰ֽ Heap Global x y
Garbage Collector ًٌٔⶴ䔲ג var x = {}; var y
= {x: x}; x = null y = null Heap Global x y
Garbage Collector Garbage CollectorָHeapךⵋ麦〳腉זؔـآؙؑزחو٦ؙ➰ֽ Heap Global x y
Garbage Collector Heap Global x y Garbage CollectorָHeapךو٦ָؙזְؔـآؙؑز灶唱ׅ
Garbage Collector Garbage CollectorָHeapךⵋ麦〳腉זؔـآؙؑزو٦ؙ و و٦ ٦ؙ ؙؿ ؿؑ
ؑ؎ ؎ؤ ؤ(Mark Phase) Garbage CollectorָHeapךⵋ麦♶〳腉זؔـآؙؑز灶唱 أ أؐ ؐ؍ ؍٦ ٦ف فؿ ؿؑ ؑ؎ ؎ؤ ؤ(Sweep Phase)
Garbage Collector ָֿ و و٦ ٦ؙ ؙ، ،ٝ ٝس
سأ أؐ ؐ؍ ؍٦ ٦ف ف(Mark And Sweep) הְֲ،ٕ؞ٔؤيדׅկ
Garbage Collector ׃ծֿךMarkPhaseהSweepPhaseכ ؔـآؙؑزךخٔ٦וךדծفؚٗٓيך؟؎ؤח״גכծ ꬊ䌢ח頾蚚ַַָתׅկ ךծ植㖈ךـٓؐؠדכֿך⹛⡲㼰׃בא遤ֲծ ؎ ؎ٝ ؙٝ
ؙٔ ًٔ ًٝ ٝة ةٕ ٕGC(Incremental GC) הㄎל䩛岀ָ欽ְגְתׅկ זחMark&Sweepדفؚٗٓيָ⨡姺׃ג׃תֲֿה Stop the world הㄎןתׅկ
Incremental Garbage Collection Garbage CollectorָHeapךⵋ麦〳腉זؔـآؙؑزחو٦ؙ➰ֽ Heap Global x y 中断
Incremental Garbage Collection Garbage CollectorָHeapךو٦ָؙזְؔـآؙؑز灶唱ׅ Heap Global x y 中断
Incremental Garbage Collection Incremental GCכMark Phaseך鷿⚥ד撑ָ㢌⻉ׅ〳腉䚍ָ֮ծ ٓ؎زغٔ،(WriteBarrier) ה״לծ撑ָ剅ֹ㢌ֿה嗚濼ׅ➬穈ָ䗳銲חזתׅկ
Incremental Garbage Collection var x = {} var y =
{} y.x = x; Object(x) Heap Object(y) WRITED
Incremental Garbage Collection Garbage CollectorכWriteBarrierח״גو٦ׁؙؔـآؙؑزכ灶唱דֹזְ Heap Global x y 中断
WRITED 削除しない
Incremental Garbage Collection Incremental GCכفؚٗٓيך⨡姺儗䫇ִך،ٕ؞ٔؤيד֮ծ GC荈⡤ך儗כⰋ⡤涸ח⠼ןתׅկ ָծ⡤䠬ך鸞䏝כֶֻ傍ֻ䠬ׄתׅկ
Summary ֿך项俱כꬊ䌢ח邌涸ז铡僇דׅկ 劤勻GCכꬊ䌢ח醱꧟דծ➂겲ך〝兰ך穠兪הדְֲ״ֲזךזךדծ 莆ָ֮倯כה帾ֻ锃ץגגְֻׁկ ֮הծhttps://github.com/authorNari/minigcח449遤ךminiGCהְֲꬊ䌢؝ٝ ػؙزז㹋鄲ָ֮ךדծ鋅גגְֻׁկ ֿך ؖك٦آ؝ؙٖءّٝך،ٕ؞ٔؤيה㹋鄲הְֲ劤ֶָׅׅדׅկ https://www.amazon.co.jp/%E3%82%AC%E3%83%99%E3%83%BC%E3%82%B8%E3%82%B3%E3%83%AC %E3%82%AF%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E3%82%A2%E3%83%AB
%E3%82%B4%E3%83%AA%E3%82%BA%E3%83%A0%E3%81%A8%E5%AE%9F%E8%A3%85-%E4%B8%AD%E6%9D %91-%E6%88%90%E6%B4%8B/dp/4798025623
׀ ׀幠 幠耮 耮֮ ֮ ָ ָה הֲ ֲ׀ ׀ׂ
ְׂ ְת ת׃ ׃