4.1 Memory Allocation Strategy

┌─────────────────────────────────────────────┐
│              Memory Management                 │
├─────────────────────────────────────────────┤
│  ┌─────────────────────────────────────────┐ │
│  │           Allocator Layer                  │ │
│  │  ┌──────────┐ ┌──────────┐ ┌──────────┐  │ │
│  │  │  Main    │ │  VRAM    │ │  Stack   │  │ │
│  │  │  Alloc   │ │  Alloc   │ │  Alloc   │  │ │
│  │  └──────────┘ └──────────┘ └──────────┘  │ │
│  └─────────────────────────────────────────┘ │
├─────────────────────────────────────────────┤
│  ┌─────────────────────────────────────────┐ │
│  │           Debug Layer (optional)            │ │
│  │  ┌──────────┐ ┌──────────┐ ┌──────────┐  │ │
│  │  │  Tracking │ │  Leak    │ │  Stats   │  │ │
│  │  │          │ │  Detection│ │          │  │ │
│  │  └──────────┘ └──────────┘ └──────────┘  │ │
│  └─────────────────────────────────────────┘ │
└─────────────────────────────────────────────┘
         │
         ▼
┌─────────────────────────────────────────────┐
│                 KOS Memory                     │
│  (malloc, free, pvr_mem_malloc, pvr_mem_free)  │
└─────────────────────────────────────────────┘