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:
@@ -0,0 +1,134 @@
|
||||
---
|
||||
id: wiki-2026-0508-major-gc
|
||||
title: Major GC
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [full-gc, old-generation-gc, mark-sweep-compact]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [gc, v8, memory, performance, jvm]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: JavaScript
|
||||
framework: V8
|
||||
---
|
||||
|
||||
# Major GC
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 Old generation 매 전체를 매 sweep 하는 매 비싼 GC cycle — 매 mark-sweep-compact 의 합성"**. 매 minor GC (Scavenge)와 대비되는 V8 의 second-tier collector — 매 long-lived object 의 final destination — 매 stop-the-world pause 의 가장 큰 원인.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 단계
|
||||
1. **Mark**: 매 root → reachable object tree-walk, mark bit set.
|
||||
2. **Sweep**: 매 unmarked region 의 free list 추가.
|
||||
3. **Compact**: 매 fragmentation 의 reduce 매 live object 매 좌측 이동.
|
||||
|
||||
### 매 trigger
|
||||
- 매 old-space 매 limit 도달.
|
||||
- 매 minor GC 매 promotion 매 spike.
|
||||
- 매 manual `--expose-gc` + `gc()` 호출.
|
||||
|
||||
### 매 응용
|
||||
1. 매 long-running Node.js server 매 latency 의 source.
|
||||
2. 매 GC tuning 의 핵심 metric.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### 매 GC log enable
|
||||
```bash
|
||||
node --trace-gc app.js
|
||||
# 매 sample
|
||||
# [12345:0x...] [Mark-Compact 250.4MB->180.2MB (300.0MB) 45.3 ms]
|
||||
```
|
||||
|
||||
### 매 PerformanceObserver
|
||||
```javascript
|
||||
const obs = new PerformanceObserver((list) => {
|
||||
for (const entry of list.getEntries()) {
|
||||
if (entry.detail.kind === 4) // 매 major GC
|
||||
console.log('Major GC:', entry.duration, 'ms');
|
||||
}
|
||||
});
|
||||
obs.observe({ entryTypes: ['gc'] });
|
||||
```
|
||||
|
||||
### 매 heap snapshot
|
||||
```javascript
|
||||
const v8 = require('v8');
|
||||
v8.writeHeapSnapshot('/tmp/snap.heapsnapshot');
|
||||
// 매 Chrome DevTools → Memory tab 매 load
|
||||
```
|
||||
|
||||
### 매 incremental marking
|
||||
```bash
|
||||
node --trace-incremental-marking app.js
|
||||
# 매 V8 매 mark phase 의 매 frame budget chunk 로 분할
|
||||
```
|
||||
|
||||
### 매 max-old-space-size
|
||||
```bash
|
||||
node --max-old-space-size=4096 app.js # 매 4GB
|
||||
# 매 default 1.4GB on 64-bit
|
||||
```
|
||||
|
||||
### 매 weak ref pattern
|
||||
```javascript
|
||||
const cache = new Map();
|
||||
const ref = new WeakRef(obj);
|
||||
// 매 GC 매 obj 의 collect 매 cache 의 자동 cleanup
|
||||
const finalizer = new FinalizationRegistry((key) => cache.delete(key));
|
||||
```
|
||||
|
||||
### 매 promotion threshold tune
|
||||
```bash
|
||||
node --min-semi-space-size=64 --max-semi-space-size=128 app.js
|
||||
// 매 young gen 의 크기 의 키워서 promotion 의 줄임
|
||||
```
|
||||
|
||||
### 매 chrome devtools profile
|
||||
```javascript
|
||||
// 매 Performance tab → Record → 매 GC marker 의 yellow bar
|
||||
// 매 매 marker 매 click → reason: "allocation failure" / "external memory"
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| 매 frequent major GC | 매 heap profile + leak hunt |
|
||||
| 매 GC pause >100ms | --max-old-space-size 의 increase |
|
||||
| 매 promotion 폭발 | --max-semi-space-size 의 increase |
|
||||
| 매 long-lived cache | WeakRef + FinalizationRegistry |
|
||||
|
||||
**기본값**: 매 trace-gc 로그로 baseline → 매 profile 후 매 tune.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[V8 가비지 컬렉션(Garbage Collection)]] · [[가비지 컬렉터(Garbage Collector)]]
|
||||
- 변형: [[Mark-Sweep-Compact(메이저 GC)]] · [[오리노코(Orinoco GC)]]
|
||||
- 응용: [[Stop-the-world]] · [[Memory Management]]
|
||||
- Adjacent: [[Scavenge]] · [[New Space(Young Generation)]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 Node.js latency spike 매 trace-gc 결과 의 해석.
|
||||
**언제 X**: 매 minor GC 의 frequent — Scavenge 분석.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **manual gc() 의 spam**: 매 incremental marking 의 방해.
|
||||
- **--expose-gc 의 prod**: 매 attacker 의 DoS vector.
|
||||
- **heap-size 의 무한 증가**: 매 swap 의 trash 매 latency 폭발.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (V8 12.x, Node.js 22+, 2026).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — Major GC mark-sweep-compact 단계 + tuning 정리 |
|
||||
Reference in New Issue
Block a user