1 / 9

GC16/3011 Functional Programming Lecture 18 Automatic Memory Management

GC16/3011 Functional Programming Lecture 18 Automatic Memory Management. Contents. What is AMM? Programmer control vs system control Reuse/recycling of memory How does AMM work? Memory allocation Garbage collection Issues How is garbage created, detected, reused?

conley
Download Presentation

GC16/3011 Functional Programming Lecture 18 Automatic Memory Management

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. GC16/3011 Functional ProgrammingLecture 18Automatic Memory Management

  2. Contents • What is AMM? • Programmer control vs system control • Reuse/recycling of memory • How does AMM work? • Memory allocation • Garbage collection • Issues • How is garbage created, detected, reused? • What overheads do we incur? (space/time) • Fragmentation

  3. What is AMM? • Biggest source of bugs: POINTERS • Big cost: • Effective management (reuse) of memory • A solution: • Don’t let programmers have direct access to memory locations (NO POINTERS) • Let system manage memory • Functional languages, Java • An onerous responsibility for the system • must never go wrong

  4. How does AMM work? • A storage manager (SM) subroutine services requests from the rest of the program • Program requests “N bytes of memory” • SM: • searches for appropriate chunk of “free” memory • Allocates the chunk (tags it “in use” or “live”) • returns a pointer to that chunk • Programmer never sees the pointer • SM detects when “in use” chunk becomes garbage and tags it “free”

  5. How does AMM work? (2) • Memory allocation techniques • Which chunk (block) of memory should the SM return in response to a request? Does it matter? • Garbage collection techniques • How to identify garbage • How to collect garbage • Compaction/defragmentation techniques • How does fragmentation occur • How can it be reduced or removed

  6. Issues: Garbage collection • How is garbage created? • Beta reduction, delta reduction … • How is garbage identified? • Number of references? … or connectivity • How is garbage collected? • Use a free list? … or not • How is garbage reused? • Cooperation with memory allocation

  7. Issues: how much does it cost? • Time • Performance degradation • Embarrassing pause? • Real-time systems? • Space • Some memory set aside for administration? • Some extra memory required per cell? • Size of code?

  8. Issues: fragmentation • What is it? • Why is it a problem? • Embedded systems • Virtual memory – paging overhead • How can it be solved? • Coalescing • Compaction: • Copying • Sliding

  9. Summary • What is AMM? • Programmer control vs system control • Reuse/recycling of memory • How does AMM work? • Memory allocation • Garbage collection • Issues • How is garbage created, detected, reused? • What overheads do we incur? (space/time) • Fragmentation

More Related