malloc()
and free()
. These are userspace functions, which both use the sbrk()
system call to request and release memory allocated to the process.
In this homework, we create an alternative memory allocator, which provides the functions myalloc()
, and myfree()
. The performance of your allocator will be measured in terms of program runtime and fragmentation.
NOTE: The template makefile tells gcc to compile in 32-bit mode, even if you're on a 64-bit system. If you get a complaint about missing stubs-32.h, just run sudo apt-get install libc6-dev-i386
.
Turn-in requirements: make your changes to hw7.c only.Your solution should use only sbrk()
to request and release memory. This means you cannot use other built-in memory allocation functions like malloc()
, calloc()
or mmap()
. Your solution will be graded based on performance in a variety of scenarios, some or all of which are already present in main.c.
./hw7 987987 Simple alloc/free, alloc/free cycle: 0, timediff:237 Coalescing free and splitting mymalloc: 0, timediff:29 After freeing coalesced blocks: -10320000, timediff:7 Random malloc and free sequence: 0, timediff: 698with 1000 16-byte spaced lists:
Simple alloc/free, alloc/free cycle: 0, timediff:291 Coalescing free and splitting mymalloc: 0, timediff:67 After freeing coalesced blocks: -10320000, timediff:7 Random malloc and free sequence: 0, timediff: 822with a single list:
Simple alloc/free, alloc/free cycle: 0, timediff:239 Coalescing free and splitting mymalloc: 0, timediff:29 After freeing coalesced blocks: -10320000, timediff:7 Random malloc and free sequence: 0, timediff: 2491without coalescing or lowering the break:
Simple alloc/free, alloc/free cycle: 100080000, timediff:332 Coalescing free and splitting mymalloc: 9216072, timediff:33 After freeing coalesced blocks: 8192064, timediff:0 Random malloc and free sequence: 497408, timediff: 2535with coalescing, but without splitting:
Simple alloc/free, alloc/free cycle: 0, timediff:230 Coalescing free and splitting mymalloc: 8192064, timediff:29 After freeing coalesced blocks: -10320000, timediff:7 Random malloc and free sequence: 0, timediff: 666
Copyright 2016 The Board of Trustees of the University of Illinois.webmaster@cs.uic.edu |
WISEST Helping Women Faculty Advance Funded by NSF | ![]() | ![]() |