[lib][heap] Add Cmpctmalloc as an alternative malloc implementation

From scratch simple binning heap. Complexity wise in the middle
between miniheap and dlmalloc. Generally much faster than miniheap
with a small amount of memory overhead. Performs similarly to
dlmalloc.
This commit is contained in:
Erik Corry
2015-10-27 16:23:56 +01:00
committed by Travis Geiselbrecht
parent 3ec7c378c8
commit 12868bf6c0
7 changed files with 870 additions and 26 deletions

View File

@@ -3,11 +3,13 @@
function HELP {
echo "help:"
echo "-b a virtio block device"
echo "-c cmpctmalloc instead of dlmalloc"
echo "-M miniheap instead of dlmalloc"
echo "-n a virtio network device"
echo "-t a virtio tap network device"
echo "-d a virtio display"
echo "-6 64bit arm"
echo "-m <memory in MB>"
echo "-M <memory in MB>"
echo "-h for help"
echo "all arguments after -- are passed to qemu directly"
exit 1
@@ -18,17 +20,20 @@ DO_NET_TAP=0
DO_BLOCK=0
DO_64BIT=0
DO_DISPLAY=0
DO_CMPCTMALLOC=0
DO_MINIHEAP=0
MEMSIZE=512
SUDO=""
while getopts bdhm:nt6 FLAG; do
while getopts bdhm:cMnt6 FLAG; do
case $FLAG in
b) DO_BLOCK=1;;
c) DO_CMPCTMALLOC=1;;
d) DO_DISPLAY=1;;
M) DO_MINIHEAP=1;;
n) DO_NET=1;;
t) DO_NET_TAP=1;;
6) DO_64BIT=1;;
6) DO_MEM=1;;
m) MEMSIZE=$OPTARG;;
h) HELP;;
\?)
@@ -73,6 +78,14 @@ else
ARGS+=$NO_DISPLAY_ARGS
fi
make $PROJECT -j4 &&
MAKE_VARS=""
if [ $DO_CMPCTMALLOC == 1 ]; then
MAKE_VARS=LK_HEAP_IMPLEMENTATION=cmpctmalloc
elif [ $DO_MINIHEAP == 1 ]; then
MAKE_VARS=LK_HEAP_IMPLEMENTATION=miniheap
fi
make $MAKE_VARS $PROJECT -j4 &&
echo $SUDO $QEMU $ARGS $@ &&
$SUDO $QEMU $ARGS $@