Professional Documents
Culture Documents
Last Time
File I/O and stdio.h
Where Do I Live?
C Memory Model
Address Space Layout
Today
Continue pages from last time
Heap Terms
brk (unistd.h)
Implicit Heap Allocator (stdlib.h)
Allocator Design
Next Time
Read: B&O 9.9.5 - 9.9.9
Allocator Implementation
CS 354 (F16): L9 - 1
Heap Terms
Terms
Dynamic Memory:
Why not simply allocate large amount of static memory to ensure sufficient capacity?
Heap:
Approaches
Implicit:
Explicit:
CS 354 (F16): L9 - 2
brk (unistd.h)
What is unistd.h?
CS 354 (F16): L9 - 3
Allocates and returns generic ptr to block of heap memory of size bytes,
memory double word aligned in Unix
void *calloc(size_t nItems, size_t size)
Allocates, clears to 0, and returns a block of heap memory of nItems * size bytes,
CS 354 (F16): L9 - 4
Allocator Design
Goals
Throughput
Memory Utilization
Requirements
2.
3.
4.
5.
Design Considerations
CS 354 (F16): L9 - 5