i want to learn how to create a more efficient malloc and I found this project. I can run make to compile it:
$ make tstmalloc
make: `tstmalloc' is up to date.
But how can I run and test it? I read the readme file but it is not detailed enough. I want to compile all the programs, test all the programs and understand what the programs do. But if I run just make then it complains in a manner that I don't understand:
$ make
gcc -g -Wall -ansi -DSTRATEGY=2 -c -o malloc.o malloc.c
malloc.c: In function ‘morecore’:
malloc.c:77:3: warning: implicit declaration of function ‘getpagesize’ [-Wimplicit-function-declaration]
noPages = ((nu*sizeof(Header))-1)/getpagesize() + 1;
^
malloc.c:78:84: error: ‘MAP_ANONYMOUS’ undeclared (first use in this function)
cp = mmap(__endHeap, noPages*getpagesize(), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
^
malloc.c:78:84: note: each undeclared identifier is reported only once for each function it appears in
malloc.c:85:5: warning: implicit declaration of function ‘perror’ [-Wimplicit-function-declaration]
perror("failed to get more memory");
^
make: *** [malloc.o] Error 1
And if I try to compile the programs individually I get another error msg that I don't understand:
$ gcc malloc.c
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire