Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Understanding Go GC #coefl_go_jp

Understanding Go GC #coefl_go_jp

2025年8月22日(金)開催、「COEFL Go-JP #2」で登壇した、弁護士ドットコム株式会社 クラウドサイン エンジニア の筒井 海人 が登壇した際の資料です。

COEFL Go-JP #2
https://gophers-ex.connpass.com/event/361339/

セッションタイトル:Understanding Go GC

■ 弁護士ドットコム株式会社プロダクト組織について
https://speakerdeck.com/bengo4com/introduction-for-creators

■ 採用情報はこちら
https://hrmos.co/pages/bengo4/jobs

■ テックブログ:弁護士ドットコム Creators’ blog
https://creators.bengo4.com/

■ X(Twitter):弁護士ドットコム CREATOR'S
https://x.com/bengo4_creators

Avatar for 弁護士ドットコム

弁護士ドットコム

August 27, 2025
Tweet

More Decks by 弁護士ドットコム

Other Decks in Technology

Transcript

  1. Bengo4.com,Inc. VISION まだないやり方で、世界を前へ。 Drive a paradigm shift for the better

    world. MISSION 「プロフェッショナル・テック 」で、次の常識をつくる。 Be the Professional-Tech Company. プロフェッショナルだからできること。専門知とテクノロジーで、社会に貢献する。
  2. Bengo4.com, Inc. OUR SERVICE 4 税理士に無料で相談・検索できる日本最大級の 税務相談ポータルサイト 最新の法改正や実務について分かりやすく解説する 日本最大級の企業法務ポータルサイト 日本最大級の無料法律相談ポータルサイト

    時事問題の弁護士解説を中心としたメディア 弁護士事務所、企業法務職向け人材紹介事業 AI基盤技術「 LegalBrain 1.0」を組み込んだ リーガル特化型 AIエージェント 契約の締結から管理までデジタルで完結させる 契約マネジメントプラットフォーム
  3. Bengo4.com, Inc. What is GC? A garbage collector is a

    system that recycles memory on behalf of the application by identifying which parts of memory are no longer needed. – A Guide to the Go Garbage Collector 6
  4. Bengo4.com, Inc. What is GC? A garbage collector is a

    system that recycles memory on behalf of the application by identifying which parts of memory are no longer needed. – A Guide to the Go Garbage Collector 7
  5. Bengo4.com, Inc. GOGC 11 GOGC sets next cycle’s target heap

    size after each GC GOGC↑ • NumGC decreases • Memory usage increases GOGC↓ • NumGC increases • Memory usage decreases
  6. Bengo4.com, Inc. Concurrent Mark and Sweep (Go 1.5~) • Tri-color

    Marking ◦ Marks with 3 colors (white, black, and grey) • Write Barrier ◦ Prevents missed references 17
  7. Bengo4.com, Inc. • White: initial state or unreachable • Grey:

    reachable but uncompleted • Black: reachable and marked Concurrent Mark and Sweep (Go 1.5~) 18 p 1 2 3 Root Queue
  8. Bengo4.com, Inc. • White: initial state or unreachable • Grey:

    reachable but uncompleted • Black: reachable and marked Concurrent Mark and Sweep (Go 1.5~) 19 p 1 2 3 Root Queue p
  9. Bengo4.com, Inc. • White: initial state or unreachable • Grey:

    reachable but uncompleted • Black: reachable and marked Concurrent Mark and Sweep (Go 1.5~) 20 p 1 2 3 Root Queue p 1
  10. Bengo4.com, Inc. • White: initial state or unreachable • Grey:

    reachable but uncompleted • Black: reachable and marked Concurrent Mark and Sweep (Go 1.5~) 21 p 1 2 3 Root Queue p 1 2
  11. Bengo4.com, Inc. • White: initial state or unreachable • Grey:

    reachable but uncompleted • Black: reachable and marked Concurrent Mark and Sweep (Go 1.5~) 22 p 1 2 3 Root Queue p 1 2 3
  12. Bengo4.com, Inc. • White: initial state or unreachable • Grey:

    reachable but uncompleted • Black: reachable and marked Concurrent Mark and Sweep (Go 1.5~) 23 p 1 2 3 Root Queue p 1 2 3
  13. Bengo4.com, Inc. • White: initial state or unreachable • Grey:

    reachable but uncompleted • Black: reachable and marked Concurrent Mark and Sweep (Go 1.5~) 24 p 1 2 3 Root Queue 1 2 3
  14. Bengo4.com, Inc. • White: initial state or unreachable • Grey:

    reachable but uncompleted • Black: reachable and marked Concurrent Mark and Sweep (Go 1.5~) 25 p 1 2 3 Root Queue 2 3
  15. Bengo4.com, Inc. • White: initial state or unreachable • Grey:

    reachable but uncompleted • Black: reachable and marked Concurrent Mark and Sweep (Go 1.5~) 26 p 1 2 3 Root Queue 3
  16. Bengo4.com, Inc. • White: initial state or unreachable • Grey:

    reachable but uncompleted • Black: reachable and marked Concurrent Mark and Sweep (Go 1.5~) 27 p 1 2 3 Root Queue
  17. Bengo4.com, Inc. • White: initial state or unreachable • Grey:

    reachable but uncompleted • Black: reachable and marked Concurrent Mark and Sweep (Go 1.5~) 28 p 1 2 3 Root Queue
  18. Bengo4.com, Inc. Takeaways • Learned the value of studying the

    runtime to write better code • Inspired to keep learning as Go keeps evolving • Looking forward to the future of Go 30
  19. Bengo4.com, Inc. • A Guide to the Go Garbage Collector

    • Why Go's Garbage Collection is a Game Changer • mgc.go • GoのGCについて理解する • GoのGC(Garbage Collection)入門 • GoのGCを10分で学ぼう • GoのGCなどで見かける3色マーキング Bibliography 31