mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
1.5 KiB
1.5 KiB
Memory Leak Analysis Report
Date: 2026-03-17
Repository: WoWee
Scope
- Reviewed explicit heap allocation sites in
src/andinclude/. - Traced allocation/free paths for:
new/deletemalloc/free- Warden emulator virtual heap allocation
- Focus was on leak behavior during long-running sessions.
Finding
1) Warden emulator heap growth leak (fixed)
- Location:
src/game/warden_emulator.cpp - Root cause:
allocateMemory()used a bump pointer (nextHeapAddr_) only.freeMemory()removed entries fromallocations_, but freed ranges were never reused.- Result: repeated
VirtualAlloc/VirtualFreepatterns still advanced heap head until exhaustion.
Impact
- Emulated heap (
HEAP_SIZE = 16MB) could exhaust over time despite correct frees. - This can break Warden module execution paths in extended sessions.
Patch Summary
- Added a free-list map in
WardenEmulatorto track reusable blocks. - Updated allocator to use first-fit from free-list before bump allocation.
- Added adjacent block coalescing in
freeMemory(). - Added top-of-heap rollback when highest free block touches current bump pointer.
- Reset allocator state on
initialize()to avoid stale state across reinitialization.
Changed Files
include/game/warden_emulator.hppsrc/game/warden_emulator.cpp
Notes
- This was a static code analysis pass (no full runtime sanitizer execution in this environment).
- No other definite leaks were confirmed in this pass.