90 likes | 157 Views
Administering a heap of H bytes. Address = 0. Address = H - 1. Free List Pointer :. Initial Layout. H-4. Address = 4. Address = 0. Address = H - 1. Key: Free block: Live block: Block header:. Free List Pointer :. After program requests block of size 26. 26. H-34. Address = 4.
E N D
Administering a heap of H bytes Address = 0 Address = H - 1 Free List Pointer :
Initial Layout H-4 Address = 4 Address = 0 Address = H - 1 Key: Free block: Live block: Block header: Free List Pointer :
After program requests block of size 26 26 H-34 Address = 4 Address = 34 Address = 0 Address = H - 1 Key: Free block: Live block: Block header: Free List Pointer :
After program requests blocks of sizes 10, 2, 18, H-78 Minimum block size=4 bytes 26 10 4 18 H-78 Address = 4 Address = 78 Address = 0 Address = H - 1 Key: Free block: Live block: Block header: Free List Pointer : (null)
After program frees one block Minimum block size=4 bytes 26 10 4 18 H-78 Address = 4 Address = 78 Address = 0 Address = H - 1 Key: Free block: Live block: Block header: Free List Pointer :
After program frees a second block (free() uses LIFO policy) Minimum block size=4 bytes 26 10 4 18 H-78 Address = 4 Address = 78 Address = 0 Address = H - 1 Key: Free block: Live block: Block header: Free List Pointer :
After program requests a block of size 8 (free block is split) Minimum block size=4 bytes 26 10 4 8 6 H-78 Address = 4 Address = 78 Address = 0 Address = H - 1 Key: Free block: Live block: Block header: Free List Pointer :
Program frees a block (free() uses LIFO policy – interim position) Minimum block size=4 bytes 26 10 4 8 6 H-78 Address = 4 Address = 78 Address = 0 Address = H - 1 Key: Free block: Live block: Block header: Free List Pointer :
Program frees a block (free() uses LIFO policy – final position) Minimum block size=4 bytes 40 4 8 6 H-78 Address = 4 Address = 78 Address = 0 Address = H - 1 Key: Free block: Live block: Block header: Free List Pointer :