[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,92 +2,153 @@
|
||||
id: wiki-2026-0508-oilpan
|
||||
title: Oilpan
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [P-Reinforce-AUTO-68FCF1]
|
||||
aliases: [Blink GC, cppgc, Oilpan GC]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
tags: [auto-reinforced]
|
||||
verification_status: applied
|
||||
tags: [gc, c++, blink, chromium, memory-management]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-20
|
||||
github_commit: "[P-Reinforce] Continuous Worker - Oilpan"
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: unspecified
|
||||
framework: unspecified
|
||||
language: C++
|
||||
framework: Blink/Chromium, cppgc (V8)
|
||||
---
|
||||
|
||||
# [[Oilpan|Oilpan]]
|
||||
# Oilpan
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> Oilpan은 [[Chrome|Chrome]]의 렌더링 엔진인 Blink에서 사용하는 가비지 컬렉터(Garbage Collector)입니다 [1]. V8 엔진의 주요 가비지 컬렉터인 [[Orinoco|Orinoco]]와 Oilpan 간의 협력을 개선하고, Orinoco의 새로운 기술을 Oilpan에 이식하려는 작업이 진행 중입니다 [1].
|
||||
## 매 한 줄
|
||||
> **"매 C++ object 매 trace-based GC"**. 매 2014 Blink (Chromium renderer) 의 DOM tree memory bug 해결 위해 도입 된 매 C++ GC. 매 2021 V8 의 매 cppgc 로 generalize 되어 매 Node.js native module / Dart VM 의 사용. 매 raw pointer 의 cycle leak 매 fundamental 해결.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
- **Blink 렌더러 소속**: Oilpan은 Chrome 내장 렌더러인 Blink를 위해 특별히 설계되고 사용되는 가비지 컬렉터입니다 [1].
|
||||
- **Orinoco와의 연계 및 기술 이식**: V8 팀은 두 가비지 컬렉터 간의 협업 및 통합을 향상시키기 위해 노력하고 있으며, V8의 최신 가비지 컬렉터 프로젝트인 Orinoco에 적용된 새로운 기술들을 Oilpan으로 이식(porting)하는 작업을 수행하고 있습니다 [1].
|
||||
## 매 핵심
|
||||
|
||||
소스에 관련 정보가 부족합니다. (제공된 소스에는 Oilpan의 구체적인 작동 원리, 아키텍처 또는 내부 구현 방식에 대한 추가적인 세부 사항이 포함되어 있지 않습니다.)
|
||||
### 매 motivation
|
||||
- 매 DOM tree 매 cyclic reference (parent ↔ child) 매 매우 흔함.
|
||||
- 매 RefCounted (smart pointer) 의 cycle 매 leak.
|
||||
- 매 manual `delete` 매 use-after-free / double-free 폭발.
|
||||
- 매 Blink 매 2010-2014 매 매 brutal memory bug 매 routine.
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌:** 자동화 엔진에 의해 매핑된 지식으로, 추후 정밀 검증 필요.
|
||||
- **정책 변화:** Programming & Language 분야의 자동 자산화 수행.
|
||||
### 매 Oilpan 동작
|
||||
- 매 `GarbageCollected<T>` base class 매 inherit → 매 GC 의 manage.
|
||||
- 매 `Member<T>` smart pointer 매 GC-tracked field 매 declare.
|
||||
- 매 `Trace(Visitor*)` virtual method 매 reachability 의 manual report.
|
||||
- 매 incremental marking + concurrent sweeping → 매 main thread pause < 1ms.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- **Related Topics:** [[Garbage Collection|Garbage Collection]], Blink, [[Orinoco|Orinoco]]
|
||||
- **Projects/Contexts:** [[Chrome|Chrome]]
|
||||
- **Contradictions/Notes:** 소스에 관련 정보가 부족합니다. (Oilpan과 관련된 내용은 소스 [1]에서 단 한 차례 간략하게만 언급되며, 구체적인 기술적 논의나 모순점은 제시되어 있지 않습니다.)
|
||||
### 매 응용
|
||||
1. Blink DOM (Element, Node, Document) 매 모든 lifecycle.
|
||||
2. V8 cppgc 매 사용 한 매 Node.js native addon.
|
||||
3. Dart VM heap.
|
||||
4. Skia paint object graph (experimental).
|
||||
|
||||
---
|
||||
*Last updated: 2026-04-19*
|
||||
## 💻 패턴
|
||||
|
||||
---
|
||||
### 1. Garbage-collected class
|
||||
```cpp
|
||||
#include "v8/cppgc/garbage-collected.h"
|
||||
#include "v8/cppgc/member.h"
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
class Node : public cppgc::GarbageCollected<Node> {
|
||||
public:
|
||||
void Trace(cppgc::Visitor* visitor) const {
|
||||
visitor->Trace(parent_);
|
||||
visitor->Trace(children_);
|
||||
}
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
|
||||
```text
|
||||
# TODO
|
||||
private:
|
||||
cppgc::Member<Node> parent_;
|
||||
cppgc::HeapVector<cppgc::Member<Node>> children_;
|
||||
};
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### 2. Allocation
|
||||
```cpp
|
||||
auto* node = cppgc::MakeGarbageCollected<Node>(heap.GetAllocationHandle());
|
||||
// 매 delete 의 X — GC 가 reclaim
|
||||
```
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### 3. Persistent (off-heap reference)
|
||||
```cpp
|
||||
class NonGcOwner {
|
||||
cppgc::Persistent<Node> root_; // 매 strong root
|
||||
cppgc::WeakPersistent<Node> observer_; // 매 weak (clear 시 nullptr)
|
||||
};
|
||||
```
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### 4. Pre-finalizer (cleanup hook)
|
||||
```cpp
|
||||
class Resource : public cppgc::GarbageCollected<Resource> {
|
||||
USING_PRE_FINALIZER(Resource, Dispose);
|
||||
void Dispose() {
|
||||
// 매 GC 직전 호출 — 매 file handle close 등
|
||||
if (fd_ >= 0) close(fd_);
|
||||
}
|
||||
void Trace(cppgc::Visitor*) const {}
|
||||
private:
|
||||
int fd_ = -1;
|
||||
};
|
||||
```
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
### 5. Cross-thread safety
|
||||
```cpp
|
||||
// 매 GC heap 매 single thread (renderer main).
|
||||
// 매 worker → main thread post 매 cppgc::CrossThreadPersistent.
|
||||
cppgc::CrossThreadPersistent<Node> handle(node);
|
||||
PostTaskToMain([handle]() {
|
||||
handle->DoSomething();
|
||||
});
|
||||
```
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
### 6. Heap stats (debugging)
|
||||
```cpp
|
||||
auto stats = heap.CollectStatistics(cppgc::HeapStatistics::DetailLevel::kDetailed);
|
||||
LOG(INFO) << "Resident: " << stats.resident_size_bytes
|
||||
<< " Used: " << stats.used_size_bytes;
|
||||
```
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
### 7. Force GC (test only)
|
||||
```cpp
|
||||
heap.ForceGarbageCollectionSlow(
|
||||
"test", "explicit",
|
||||
cppgc::Heap::StackState::kNoHeapPointers);
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Acyclic ownership | `unique_ptr` / `shared_ptr` (no GC needed) |
|
||||
| Cyclic graph (DOM-like) | Oilpan / cppgc |
|
||||
| Latency-critical realtime | Avoid — GC pause unpredictable |
|
||||
| Cross-language boundary (V8) | cppgc 매 V8 와 매 unified heap |
|
||||
| Embedded / no V8 | Standalone cppgc library |
|
||||
|
||||
**기본값**: 매 cycle 가능 한 graph 에서만 Oilpan. 매 simple ownership 매 RAII.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Garbage Collection]] · [[Tracing GC]]
|
||||
- 변형: [[Boehm GC]] · [[V8 GC]] · [[Mark-Sweep-Compact]]
|
||||
- 응용: [[Blink (Chromium)]] · [[V8 Embedder API]] · [[Dart VM]]
|
||||
- Adjacent: [[Tri-color Marking]] · [[Conservative Stack Scanning]] · [[Reference Counting]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 C++ project 에서 매 cyclic object graph 매 unavoidable. 매 V8 embedder 매 native object 와 JS object 의 unified GC.
|
||||
**언제 X**: 매 simple resource ownership (RAII 매 충분). 매 hard real-time. 매 embedded (memory budget tight).
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Raw pointer 매 GC heap object 매 hold**: 매 GC 가 collect → use-after-free. 매 항상 Member/Persistent.
|
||||
- **Trace 매 incomplete**: 매 missed field 매 premature collection. 매 Clang plugin 매 lint check 활용.
|
||||
- **Pre-finalizer 매 heavy work**: 매 GC 의 pause 증가. 매 light cleanup 만.
|
||||
- **Cross-thread 매 raw Member**: 매 data race + 매 GC 의 oblivious. 매 CrossThreadPersistent 사용.
|
||||
- **Stack 의 conservative scan 의 abuse**: 매 false retention. 매 kNoHeapPointers state 매 가능 한 사용.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (V8 cppgc docs, Blink rendering core 2026-05, Dart VM source).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — Oilpan/cppgc unified heap + Member/Persistent pattern |
|
||||
|
||||
Reference in New Issue
Block a user