C Tutorial Automatic Garbage collection
The C Language
C History
BCPL
Euclidís Algorithm in C
Euclid on the PDP-11
Pieces of C
C Types
Declarators
Struct bit-fields
Code generated by bit fields
C Unions
Layout of Records and Unions
C Storage Classes
malloc() and free()
Dynamic Storage Allocation
Simple Dynamic Storage Allocation
malloc() and free() variants
Fragmentation
Fragmentation and Handles
Automatic Garbage Collection

Arrays
Lazy Logical Operators
The Switch Statement
setjmp/longjmp: Sloppy exceptions
Nondeterminism in C

 

 

HOME
 


 
  • Remove the need for explicit deallocation.

  • System periodically identifies reachable memory and frees unreachable memory.

  • Reference counting one approach.

Mark-and-sweep another: cures fragmentation. Used in Java, functional languages, etc.

Challenges:

How do you identify all reachable memory?

(Start from program variables, walk all data structures.) Circular structures defy reference counting:
 

  • Neither is reachable, yet both have non-zero reference counts

  • Garbage collectors often conservative: donít try to collect everything, just that which is definitely garbage.

 

Contact for more learning: webmaster@freehost7com