Files
2nd/10_Wiki/Topics/Domain_Programming/DevOps_and_Security/Oilpan.md
T
Antigravity Agent c24165b8bc refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게
[공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류.
문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인).

- Topic_Programming → Domain_Programming (내부 구조 보존)
- Topic_Graphic → Domain_Design
- Topic_Business → Domain_Product
- Topic_General → Domain_General
- _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning),
  Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing)
- 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서)
- 빈 폴더 정리 (memory/procedures)
- 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 11:05:56 +09:00

4.9 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-2026-0508-oilpan Oilpan 10_Wiki/Topics verified self
Blink GC
cppgc
Oilpan GC
none A 0.9 applied
gc
c++
blink
chromium
memory-management
2026-05-10 pending
language framework
C++ Blink/Chromium, cppgc (V8)

Oilpan

매 한 줄

"매 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 해결.

매 핵심

매 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.

매 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.

매 응용

  1. Blink DOM (Element, Node, Document) 매 모든 lifecycle.
  2. V8 cppgc 매 사용 한 매 Node.js native addon.
  3. Dart VM heap.
  4. Skia paint object graph (experimental).

💻 패턴

1. Garbage-collected class

#include "v8/cppgc/garbage-collected.h"
#include "v8/cppgc/member.h"

class Node : public cppgc::GarbageCollected<Node> {
 public:
  void Trace(cppgc::Visitor* visitor) const {
    visitor->Trace(parent_);
    visitor->Trace(children_);
  }

 private:
  cppgc::Member<Node> parent_;
  cppgc::HeapVector<cppgc::Member<Node>> children_;
};

2. Allocation

auto* node = cppgc::MakeGarbageCollected<Node>(heap.GetAllocationHandle());
// 매 delete 의 X — GC 가 reclaim

3. Persistent (off-heap reference)

class NonGcOwner {
  cppgc::Persistent<Node> root_;  // 매 strong root
  cppgc::WeakPersistent<Node> observer_;  // 매 weak (clear 시 nullptr)
};

4. Pre-finalizer (cleanup hook)

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;
};

5. Cross-thread safety

// 매 GC heap 매 single thread (renderer main).
// 매 worker → main thread post 매 cppgc::CrossThreadPersistent.
cppgc::CrossThreadPersistent<Node> handle(node);
PostTaskToMain([handle]() {
  handle->DoSomething();
});

6. Heap stats (debugging)

auto stats = heap.CollectStatistics(cppgc::HeapStatistics::DetailLevel::kDetailed);
LOG(INFO) << "Resident: " << stats.resident_size_bytes
          << " Used: " << stats.used_size_bytes;

7. Force GC (test only)

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

🤖 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