9148c358d0
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 폴더 제거.
4.4 KiB
4.4 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-memory-management | Memory Management | 10_Wiki/Topics | verified | self |
|
none | A | 0.9 | applied |
|
2026-05-10 | pending |
|
Memory Management
매 한 줄
"매 program 매 lifetime 동안 의 allocation/deallocation 의 전략". 매 manual (C/C++) ↔ ARC (Swift/ObjC) ↔ tracing GC (V8/JVM) ↔ ownership (Rust) — 매 spectrum 의 각 trade-off — 매 2026 의 mainstream 4 가지 paradigm 의 공존.
매 핵심
매 4 가지 paradigm
- Manual: malloc/free, new/delete — 매 control 최대, 매 leak 위험.
- Reference counting: ARC, shared_ptr — 매 deterministic, 매 cycle 문제.
- Tracing GC: V8, JVM, .NET — 매 productivity, 매 pause.
- Ownership: Rust borrow checker — 매 zero-runtime overhead, 매 learning curve.
매 핵심 metric
- RSS (resident set size): 매 OS 시점.
- Heap used: 매 runtime 시점.
- External: 매 native buffer (Node
Buffer). - Fragmentation: 매 allocate 가능하지만 매 contiguous block 부재.
매 응용
- 매 long-running server 의 stability.
- 매 game engine 의 frame budget.
- 매 embedded 의 RAM 의 limit.
💻 패턴
매 manual (C)
char *buf = malloc(1024);
if (!buf) { perror("malloc"); exit(1); }
// ... use ...
free(buf);
buf = NULL; // 매 dangling 의 방지
매 RAII (C++)
{
std::unique_ptr<MyObj> p = std::make_unique<MyObj>();
// 매 scope exit 매 자동 delete
}
std::shared_ptr<MyObj> sp = std::make_shared<MyObj>();
// 매 ref-count 0 매 free
매 ownership (Rust)
fn take(s: String) { /* 매 drop on end */ }
let owned = String::from("hi");
take(owned);
// println!("{}", owned); // 매 compile error: moved
매 tracing GC (JS)
let cache = new Map();
cache.set('a', { big: new Array(1e6) });
cache = null; // 매 GC 의 next cycle 의 reclaim
// 매 WeakMap 매 key 의 GC 자동 cleanup
const wm = new WeakMap();
매 Node memory inspect
const v8 = require('v8');
console.log(v8.getHeapStatistics());
// { total_heap_size: ..., used_heap_size: ..., heap_size_limit: ... }
process.memoryUsage();
// { rss, heapTotal, heapUsed, external, arrayBuffers }
매 leak detection (Node)
node --inspect app.js
# Chrome DevTools → Memory → Take snapshot → 매 sample 3 개 → comparison view
node --heapsnapshot-signal=SIGUSR2 app.js
kill -USR2 $(pgrep node)
매 pool allocator
class Pool {
std::vector<MyObj*> free_;
public:
MyObj* acquire() {
if (free_.empty()) return new MyObj();
auto* p = free_.back(); free_.pop_back(); return p;
}
void release(MyObj* p) { free_.push_back(p); }
};
// 매 hot path 매 alloc 의 amortize
매 arena (Rust bumpalo)
use bumpalo::Bump;
let arena = Bump::new();
let s = arena.alloc(String::from("hi"));
let v = arena.alloc(vec![1, 2, 3]);
// 매 arena drop 매 모두 free — 매 deallocation O(1)
매 결정 기준
| 상황 | Approach |
|---|---|
| 매 systems / kernel | manual + sanitizer |
| 매 high-perf game | RAII + pool |
| 매 server productive | tracing GC + tune |
| 매 safety + perf | Rust ownership |
| 매 short-lived bulk | arena |
기본값: 매 language idiom 따름 — 매 C++ RAII, 매 JS GC, 매 Rust ownership.
🔗 Graph
- 부모: Performance
- 변형: Garbage Collection · ARC · Ownership
- 응용: V8 Engine Heap Management · Major GC
- Adjacent: 가비지 컬렉터(Garbage Collector) · 힙 메모리(Heap Memory)
🤖 LLM 활용
언제: 매 memory leak / OOM 의 hunt 매 paradigm 의 선택. 언제 X: 매 high-level business logic 의 memory 의 의식 안 해도 됨.
❌ 안티패턴
- manual + GC mix 매 over-confidence: 매 native buffer leak.
- shared_ptr cycle: 매 weak_ptr 의 break.
- arena 매 long-lived: 매 effective leak.
- Rust 매 unsafe 의 무분별: 매 borrow checker 의 우회.
🧪 검증 / 중복
- Verified (V8/JVM/Rust/glibc 2026 documentation).
- 신뢰도 A.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — 4가지 메모리 관리 paradigm 비교 + pattern 정리 |