9.20
using malloc lib code from csapp site
- implicit idle list
- allocated block with header & footer
- idle block with header & footer
- no GC
- first fit strategy
another modification to malloc lib file
mm.h
!INCLUDE "./code/malloc/mm.h.diff"
memlib.c
!INCLUDE "./code/malloc/memlib.c.diff"
main.c file measure malloc performance
!INCLUDE "./code/malloc/main.c"
run make
to generate both origin main executable file and custom version(using-DCUS_MALLOC
)
!INCLUDE "./code/malloc/makefile"
measurement
(cd chapter9/code/malloc; make measure)
time ./origin.main
malloc size: 25000000, heap_size: 28311552
0.00user 0.01system 0:00.01elapsed 100%CPU (0avgtext+0avgdata 19256maxresident)k
0inputs+0outputs (0major+4547minor)pagefaults 0swaps
time ./custom.main
malloc size: 25000000, heap_size: 31327104
0.58user 0.00system 0:00.58elapsed 99%CPU (0avgtext+0avgdata 30592maxresident)k
0inputs+0outputs (0major+7339minor)pagefaults 0swaps
当前内容版权归 DreamAndDead 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 DreamAndDead .