# Box64 1. 記憶體管理 >參考 [issues 2588](https://github.com/ptitSeb/box64/issues/2588) box64 有三種 memory allocator, 其功能是為 box64 自身(internal)提供記憶體,包括 rbtree, dynamic block, symbol table 等。 最小的記憶體配置單位是 128 bytes 2. Meta Date - `x64emu_t` `x64emu_t` is the complete “snapshot” of an x86-64 CPU (registers, flags, memory-management state, SIMD/FPU/MMX units, segment registers) plus all of the Box64 runtime’s bookkeeping (deferred-flags machinery, scratch buffers, control flags, parent context pointer, and various architecture‐specific helpers). - `box64context_t` `box64context_t` holds all of Box64’s global runtime state: configuration, tracing/disassembly handles, loaded binaries and libraries, dynarec vs. interpreter locks, shortcut pointers to common libraries, deferred init lists, TLS, cleanup handlers, signal stubs, and rolling debug logs. 3. emulation - `DynaRun` 4. wrapping 5. thread and fork ### 遇到的問題 1. 我不知道 `jump table` 和 `dynamic block` 的關係,但我注意到在 `getDB` 程式中可以將地址透過 `jump table` 來尋找其所在的 `dynamic block`, 而且兩者建立時都會分配到 2MB 的空間。 jump 是指 dynamic block 之間的 link 嗎? 2. 我注意到有個編譯選項 `-DSAVE_MEM` >it only increases the jumptable from 4 levels to 5. The added granularity avoids wasting space, but adds one more read from memory when jumping between blocks. jumptable 的 level 是什麼意思?在哪裡可以讀到相關資料? 3. 32 位元的 `emufloat` 會跑的比 64 位元的 `emufloat` 還要快,但其他 benchmark 則相反 4. 在 RV64 環境值執行 32 位元的 `bitfield` benckmark 會出現記憶體區段錯誤(`malloc` 之後) 5. 我不知道什麼情況下 2MB 的 dynamic block 會出現「沒裝滿就換下一個」的情況,目前只有追到「滿了」的條件。 我測試簡單的程式(僅有兩次的 malloc 與對請求的記憶體賦值) ,發現 jump table 建立 6 次, dynamic block (函式叫 dynamic map) 建立 12 次,總共 36 MB,我認為有機會減少,但我不知道怎麼做 6. 無法解釋 box64 為何在執行不同 benchmark 上會有巨大的速度差距,我無法找出 box64 擅長的任務,我也不知道要怎麼測試與歸納 7. 我不知道在 dynamic block 中儲存以及讀取 instruction 的方式 8. 在 custommem.c 中有兩種 lock : mutex_prot (出現 14 次)和 mutex_blocks (出現 37 次) 但我不知道如何觀察 lock contention ### 可以展示的內容