Files
2nd/10_Wiki/Topic_Programming/DevOps_and_Security/Oilpan.md
T
Antigravity Agent 9148c358d0 docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
2026-07-05 00:33:48 +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