# GC16/3011 Functional Programming Lecture 19 Memory Allocation Techniques - PowerPoint PPT Presentation

PPT – GC16/3011 Functional Programming Lecture 19 Memory Allocation Techniques PowerPoint presentation | free to download - id: 815369-ODcxO

The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
Title:

## GC16/3011 Functional Programming Lecture 19 Memory Allocation Techniques

Description:

### Title: D16 Functional Programming Subject: Option Talk (10 mins) Author: Chris Clack Last modified by: cs Created Date: 1/10/2000 9:51:56 PM Document presentation format – PowerPoint PPT presentation

Number of Views:8
Avg rating:3.0/5.0
Slides: 8
Provided by: ChrisC300
Category:
Tags:
Transcript and Presenter's Notes

Title: GC16/3011 Functional Programming Lecture 19 Memory Allocation Techniques

1
GC16/3011 Functional ProgrammingLecture
19Memory Allocation Techniques
2
Contents
• Pointer increment
• Free list sequential fits
• Segregated free lists
• Buddy systems

3
Pointer increment
• Ideal world
• all allocated memory would be at one end
• All free memory at other end
• Single pointer to boundary
• To allocate a block of size N, increment the
boundary pointer by N and return the original
value of the boundary pointer
• Problems to achieve an ideal world may be
costly

4
Free list sequential fits
• Assume all free blocks chained together into a
• A pointer holds the start of this chain
• Freed blocks either added to start (LIFO) or end
(FIFO) of chain, or inserted into chain in order
• First fit allocation
• Larger blocks near start of list tend to be split
first, resulting in many small fragments at start
of list
• Next fit allocation
• Tends to increase fragmentation in practice
• Best fit allocation
• Tiny fragments? Not in practice.
• Slow? Not always.

5
Segregated free lists
• Set of free lists
• each for blocks of a specific size
• or for a range of sizes
• Use first-fit or next-fit etc within free list
• Good fit
• Or even worst fit
• Use an array of pointers to the free lists
• Or a tree of pointers to the free lists

6
Buddy systems
• Variant of segregated free lists
• Aimed to optimize splitting and coalescing
• A free area may only be merged with its buddy
• When block freed - (unique) buddy found by simple
• wholly in use, or wholly free (so can merge)
• Binary buddies
• problem with internal frags (25)
• Double buddies
• uses powers-of-two (2, 4, 8) AND
double-from-three (3, 6, 12)
• Better frags (12.5) but restricted coalescing

7
Summary
• Pointer increment
• Free list sequential fits
• Segregated free lists
• Buddy systems