mfunyu / malloc

Find out the workings behind optimum memory management and recode it, as well as free and realloc.
2 stars 0 forks source link

[error] some addresses are considered as not allocated #58

Closed mfunyu closed 5 months ago

mfunyu commented 5 months ago
$> ./tests/benchmark.sh
===== Benchmark-tiny: time overhead =====
10000 loops of 1000 mallocs and 500 free
-> 10000000 mallocs, 5000000 frees
size: 1056
chunk: 0x7f31cd8a6bc0
Error: ppp pointer being freed was not allocated
size: 1056
chunk: 0x7f31b8a34bc0
Error: ppp pointer being freed was not allocated
size: 1056
chunk: 0x7f319f23abc0
Error: ppp pointer being freed was not allocated
size: 1056
chunk: 0x7f319cd5cbc0
Error: ppp pointer being freed was not allocated

real    0m7.393s
user    0m4.178s
sys 0m0.758s
mfunyu commented 5 months ago

the last block of the tiny zone could be bigger than 1040 request: 1024 add header: 1032 align 16: 1040

block exist: 1056 minimum size to divide blocks: 32

max_size = 1056 ALIGN(TINY_MAX + CHUNK_OVERHEAD, 16) + 16