Professional Documents
Culture Documents
010outlineW4W PDF
010outlineW4W PDF
Last Time
Continue pages
Heap Terms
brk (unistd.h)
Today
Implicit Heap Allocator (stdlib.h) (from last time)
Allocator Design (from last time)
A Bit of Linux
Simple View of Heap
Free Block Organization
Next Time
Read: B&O 9.9.10 - 9.9.11
Implicit Free List
A Bit of Linux
Program Size
size <executable or object_file>
bss
4
dec
1309
hex filename
51d a.out
%cat /proc/<pid_of_process>/maps
%cat /proc/self/maps
Diagram Layout
0x_00
0x_08
1 byte
0x_10
0x_18
1 word
= 4 bytes
0x_20
0x_28
0x_30
0x_38
0x_40
0x_28
0x_30
0x_38
0x_40
double word
= 8 bytes
0x_08
0x_10
0x_18
0x_20
p1
p2
p3
p4
=
=
=
=
malloc(2
malloc(3
malloc(4
malloc(5
*
*
*
*
sizeof(int));
sizeof(char));
sizeof(int));
sizeof(int));
Internal Fragmentation:
External Fragmentation:
0x_00
0x_08
0x_10
0x_18
0x_20
0x_28
0x_30
0x_38
0x_40