--- id: P-REINFORCE-AUTO-D05474 category: "[[10_Wiki/πŸ’‘ Topics/Programming & Language]]" confidence_score: 0.90 tags: [auto-reinforced] last_reinforced: 2026-04-20 github_commit: "[P-Reinforce] Continuous Worker - Memory Leak(λ©”λͺ¨λ¦¬ λˆ„μˆ˜)" --- # [[Memory Leak(λ©”λͺ¨λ¦¬ λˆ„μˆ˜)]] ## πŸ“Œ ν•œ 쀄 톡찰 (The Karpathy Summary) > λ©”λͺ¨λ¦¬ λˆ„μˆ˜(Memory Leak)λŠ” ν”„λ‘œκ·Έλž¨μ΄ 더 이상 ν•„μš”ν•˜μ§€ μ•Šμ€ λ©”λͺ¨λ¦¬λ₯Ό ν•΄μ œν•˜μ§€ μ•Šμ•„, ν•΄λ‹Ή λ©”λͺ¨λ¦¬κ°€ 운영체제의 κ°€μš© λ©”λͺ¨λ¦¬ ν’€λ‘œ λ°˜ν™˜λ˜μ§€ μ•ŠλŠ” ν˜„μƒμ„ μ˜λ―Έν•©λ‹ˆλ‹€ [1]. JavaScript와 같은 κ°€λΉ„μ§€ μ»¬λ ‰μ…˜(GC) 기반 μ–Έμ–΄μ—μ„œλŠ” λ©”λͺ¨λ¦¬κ°€ λ‹¨μˆœνžˆ μœ μ‹€λ˜λŠ” 것이 μ•„λ‹ˆλΌ, 더 이상 μ‚¬μš©λ˜μ§€ μ•Šμ•„μ•Ό ν•  객체듀이 GC 루트(window, ν™œμ„± ν΄λ‘œμ €, 이벀트 λ¦¬μŠ€λ„ˆ, 타이머 λ“±)μ—μ„œ μ—¬μ „νžˆ μ°Έμ‘° κ°€λŠ₯(reachable)ν•œ μƒνƒœλ‘œ 남아 μžˆμ–΄ κ°€λΉ„μ§€ 컬렉터가 이λ₯Ό νšŒμˆ˜ν•˜μ§€ λͺ»ν•  λ•Œ λ°œμƒν•©λ‹ˆλ‹€ [2, 3]. μ΄λŸ¬ν•œ λˆ„μˆ˜κ°€ λˆ„μ λ˜λ©΄ μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ˜ μ„±λŠ₯이 μ €ν•˜λ˜κ³  μž¦μ€ κ°€λΉ„μ§€ μ»¬λ ‰μ…˜ μΌμ‹œ μ •μ§€λ₯Ό μœ λ°œν•˜λ©°, μ΅œμ’…μ μœΌλ‘œλŠ” λ©”λͺ¨λ¦¬ 고갈둜 μΈν•œ ν¬λž˜μ‹œ(OOM, Out-Of-Memory)둜 μ΄μ–΄μ§€κ²Œ λ©λ‹ˆλ‹€ [1, 4, 5]. ## πŸ“– κ΅¬μ‘°ν™”λœ 지식 (Synthesized Content) λ³Έλ¬Έ ꡬ쑰화 μž‘μ—… 쀑... ## ⚠️ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & RL Update) - **κ³Όκ±° λ°μ΄ν„°μ™€μ˜ 좩돌:** μžλ™ν™” 엔진에 μ˜ν•΄ λ§€ν•‘λœ μ§€μ‹μœΌλ‘œ, μΆ”ν›„ μ •λ°€ 검증 ν•„μš”. - **μ •μ±… λ³€ν™”:** Programming & Language λΆ„μ•Όμ˜ μžλ™ μžμ‚°ν™” μˆ˜ν–‰. ## πŸ”— 지식 μ—°κ²° (Graph) - **Related Topics:** [[Garbage Collection(κ°€λΉ„μ§€ μ»¬λ ‰μ…˜)]], [[V8 JavaScript Engine]], [[Heap Snapshot(νž™ μŠ€λƒ…μƒ·)]], [[Closure(ν΄λ‘œμ €)]] - **Projects/Contexts:** [[Frontend Browser Diagnostics]], [[Node.js Production Monitoring]] - **Contradictions/Notes:** * λ©”λͺ¨λ¦¬κ°€ μ¦κ°€ν•œλ‹€κ³  ν•΄μ„œ 무쑰건 λˆ„μˆ˜μΈ 것은 μ•„λ‹™λ‹ˆλ‹€. μΊμ‹œλ‚˜ μ‹€ν–‰ μ·¨μ†Œ λ‚΄μ—­(undo histories) 등은 μ˜λ„μ μœΌλ‘œ 데이터λ₯Ό λ³΄μ‘΄ν•˜λ―€λ‘œ, μ†ŒμŠ€μ—μ„œλŠ” 'μ˜λ„μ  보쑴(intentional retention)'κ³Ό '우발적 λˆ„μˆ˜(accidental retention)'λ₯Ό λͺ…ν™•νžˆ ꡬ뢄해야 ν•œλ‹€κ³  κ°•μ‘°ν•©λ‹ˆλ‹€ [12]. * `WeakRef`와 `FinalizationRegistry`λ₯Ό μ‚¬μš©ν•΄ κ°€λΉ„μ§€ μ»¬λ ‰μ…˜μ„ λ°©ν•΄ν•˜μ§€ μ•ŠλŠ” μ°Έμ‘° νŒ¨ν„΄μ„ λ§Œλ“€ 수 μžˆμ§€λ§Œ, κ°€λΉ„μ§€ μ»¬λ ‰ν„°μ˜ μ‹€ν–‰ 일정은 비결정적(non-deterministic)μ΄λ―€λ‘œ 이λ₯Ό μ μ ˆν•œ 수λͺ… μ£ΌκΈ° 관리(lifecycle management)의 λŒ€μ²΄μž¬λ‘œ μ‚¬μš©ν•΄μ„œλŠ” μ•ˆ λ©λ‹ˆλ‹€ [11]. --- *Last updated: 2026-04-19* - Raw Source: [[00_Raw/2026-04-20/Memory Leak(λ©”λͺ¨λ¦¬ λˆ„μˆ˜).md]] ---