Open
Description
In src/custommem.c
the function:
void* map128_customMalloc(size_t size, int is32bits) {
size = 128;
…
}
hard-codes every allocation to 128 bytes.
However, In my profiling (box64 + wine just like #2511 )
most allocation requests are far smaller (e.g. ≤ 56 bytes), so this can increase internal fragmentation.
4 | 1030 |
---|---|
8 | 85 |
16 | 716 |
32 | 268 |
40 | 14 |
56 | 7998 |
64 | 34 |
96 | 81 |
120 | 1152 |
128 | 24 |
Questions:
-
What was the original design rationale for fixing the block size at 128?
-
Is it for alignment, page-size granularity, mmap overhead, or something else?
-
Would it be beneficial to reduce this to 64?
I’m happy to draft a PR to change the default to 64 if that would help.
Environment
- Box64 version: Box64 riscv64 v0.3.7 926a598 with Dynarec built on Jun 13 2025
- Build flags:
cmake -G Ninja \
-DBOX32=ON \
-DRV64=1 \
-DRV64_DYNAREC=ON \
-DGDBJIT=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_C_COMPILER=gcc \
..
- Platform: RISC-V 64, Debian (chroot)
- CPU: 4× cores(Andes AX45MP), Little Endian
- page size 4096
- Kernel: 6.1.47+
- gcc :(Debian 14.2.0-19) 14.2.0
- glibc :(Debian GLIBC 2.41-7) 2.41
Thanks!