Introduction_to_Garbage_Collection_I_Why_is_Automatic_GC_Important_and_Hard_II_Reference_Co外文翻译.pdf
文本预览下载声明
Lecture 12
Introduction to Garbage Collection
I Why is Automatic GC Important and Hard?
II Reference Counting
III Basic Trace-Based GC
Readings: Chapter 7.4-7.6.4
Advanced Compilers M. Lam
I. Memory Management, manual or automatic
• Memory management: reclaim unused memory space
• Why do we care about memory management?
• When do we care about memory management?
• What is perfect memory management?
Advanced Compilers 2 L12: Garbage Collection
Why Automatic Memory Management?
• Perfect
live dead
not deleted −−−
deleted −−−
• Manual management
live dead
not deleted
deleted
• Assume for now the target language is Java
Advanced Compilers 3 L12: Garbage Collection
What is Garbage?
Advanced Compilers 4 L12: Garbage Collection
When is an Object not Reachable?
• Mutator (the program)
• New / malloc: (creates objects)
• Store p in a pointer variable or field in an object
• Load p
• Procedure calls
• Important property
• once an object becomes unreachable, stays unreachable!
Advanced Compilers
显示全部