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 폴더 제거.
This commit is contained in:
Antigravity Agent
2026-07-05 00:33:48 +09:00
parent 1cfd3bbb56
commit 9148c358d0
6455 changed files with 1 additions and 86875 deletions
@@ -0,0 +1,149 @@
---
id: wiki-2026-0508-scavenge
title: Scavenge
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Minor GC, Scavenger, Young Generation GC, Cheney Scavenger]
duplicate_of: none
source_trust_level: A
confidence_score: 0.95
verification_status: applied
tags: [v8, garbage-collection, memory, runtime]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: cpp
framework: v8-orinoco
---
# Scavenge
## 매 한 줄
> **"매 young object 의 매 빠른 die — 매 cheap 하게 collect"**. Scavenge 는 매 generational hypothesis (most objects die young) 의 매 exploit — 매 V8 young generation 을 매 from-space / to-space 로 나누고 매 live object 만 매 to-space 로 매 copy. 매 dead object 는 매 단순 abandon. 2026 V8 (Orinoco) 에서 매 parallel + concurrent 로 매 main-thread pause < 1ms.
## 매 핵심
### 매 Cheney's algorithm
1. Allocate in to-space (linear bump pointer).
2. When full → 매 swap roles. From-space = 매 old to-space.
3. From roots, copy 매 reachable object to (new) to-space.
4. Update 매 forwarding pointer in from-space slot.
5. BFS through copied objects, copying 매 referenced objects.
6. Done → from-space 매 entirely abandoned.
### 매 V8-specific
- Young gen = New Space ≈ 18 MB per worker.
- Promotion: 매 survives 2 scavenges → 매 Old Space.
- Parallel Scavenge (2018+): 매 multiple threads.
- Concurrent (2021+): root marking on background.
### 매 응용
1. JS heap young gen.
2. Java HotSpot Young Generation (Parallel Scavenge collector).
3. .NET Gen 0/1.
4. Erlang per-process heap.
## 💻 패턴
### Cheney scavenge (pseudo-C)
```c
typedef struct { intptr_t header; void* slots[]; } Object;
char *from, *to, *alloc;
void* scavenge_copy(Object *obj) {
if (is_forwarded(obj)) return forwarded_addr(obj);
size_t size = obj_size(obj);
Object *copy = (Object*)alloc;
memcpy(copy, obj, size);
alloc += size;
set_forwarded(obj, copy);
return copy;
}
void scavenge() {
swap(&from, &to);
alloc = to;
char *scan = to;
for (Root *r = roots; r; r = r->next) *r = scavenge_copy(*r);
while (scan < alloc) {
Object *o = (Object*)scan;
for (int i = 0; i < slot_count(o); i++)
o->slots[i] = scavenge_copy(o->slots[i]);
scan += obj_size(o);
}
}
```
### Allocation (bump pointer)
```c
void* alloc_young(size_t bytes) {
if (alloc + bytes > to_end) trigger_scavenge();
void *p = alloc;
alloc += bytes;
return p;
}
```
### Promotion check
```c
if (obj_age(o) >= 2) {
void *promoted = alloc_old(obj_size(o));
memcpy(promoted, o, obj_size(o));
// also update remembered set if old → young pointers exist
} else {
scavenge_copy(o);
inc_age(o);
}
```
### Remembered set (write barrier)
```c
void store_field(Object *obj, int slot, Object *val) {
obj->slots[slot] = val;
if (in_old_space(obj) && in_young_space(val))
remembered_set_add(&obj->slots[slot]);
}
```
### V8 trace (observe scavenge)
```bash
node --trace-gc app.js
# [12345:0x...] 100 ms: Scavenge 5.5 (6.7) -> 4.8 (7.7) MB, 0.4 / 0.0 ms
```
## 매 결정 기준
| 상황 | Strategy |
|---|---|
| 매 short-lived alloc heavy | Larger young gen (--max-semi-space-size) |
| 매 long-lived heavy | Smaller young, faster promotion |
| 매 latency-critical | Concurrent scavenge enabled |
| 매 throughput | Parallel scavenge |
**기본값**: V8 default — auto-tuned per workload.
## 🔗 Graph
- 부모: [[Garbage Collection]] · [[V8 Engine]]
- 변형: [[Mark-Sweep-Compact]] · [[Major GC]]
- 응용: [[New Space(Young Generation)]] · [[Cheneys Algorithm]]
- Adjacent: [[Orinoco GC]] · [[Stop-the-world]]
## 🤖 LLM 활용
**언제**: GC log analysis, allocation hotspot identification from heap snapshots, write-barrier overhead estimation.
**언제 X**: 매 actual GC algorithm change — runtime team only.
## ❌ 안티패턴
- **Massive young alloc + immediate retain**: 매 promotion storm → 매 old space pressure.
- **Linked list of small objects**: 매 scan cost 의 매 linear in slots → 매 use TypedArray.
- **Disabling GC**: 매 --no-gc — 매 memory grows unbounded.
## 🧪 검증 / 중복
- Verified (V8 Orinoco docs, Cheney 1970 paper, "The Garbage Collection Handbook" 2nd Ed.).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — Cheney + V8 Orinoco parallel-concurrent state |