Title: Increasing Memory Usage in RealTime GC
1Increasing Memory Usage inReal-Time GC
- Tobias Ritzau and Peter Fritzson
- Department of Computer and Information Science
- Linköpings universitet
- tobri_at_ida.liu.se
- http//www.ida.liu.se/tobri
2The Problem
- Published real real-time garbage collectors
consume too much memory - A large portion of the overhead is caused by type
information, internal fragmentation, and GC house
keeping - However, most GC techniques also require a buffer
to hold dead objects
3Mark-Sweep
Root
4Buffer for Dead Objects
5Buffer for Dead Objects
6RT-Copying
7RT-Mark-Sweep (JamaicaVM)
8Available Memory
- The amount of available memory using real-time
garbage collection and a heap of 12 36 byte
objects (equally distributed) is - Copying GC 25
- Mark-Sweep (JamaicaVM) 31
- Reference Counting 47
9Reference Counting
1
2
1
1
0
1
1
0
2
1
0
2
1
1
0
Root
10Reference Counting
- Disadvantages to overcome
- Recursive freeing
- External fragmentation
- Reclaiming dead cyclic data structures
- Execution speed
11Recursive Freeing
- The problem was solved for equally sized objects
by Weizenbaum (1963) - Decrementing child references is postponed until
the memory is reused - Still, all memory is available when it becomes
unreachable - However, objects are not always of the same size
12External Fragmentation
- As in most file systems, the heap can be divided
into equally sized blocks - Small objects are linked using a list, while
larger objects use a tree structure - Minor performance penalty for small objects
- Weizenbaums technique to eliminate recursive
freeing can be used on the blocks
13Dead Cyclic Data Structures
- Manual techniques cover most cases
- Breaking cycles
- Weak references
- Balloon types
- Automatic techniques are not real-time
- A backup real-time mark-sweep GC can be used but
that increases memory overhead
14Execution Time
- Peep hole optimization
- Stack allocation
- Object owning (Data flow analysis)
15RT-Reference Counting
- All operations are predictable in memory usage
and execution time - Memory usage is increased by more than 50 for
objects larger than 17 bytes - Dead cyclic data structures can be reclaimed (to
the cost of memory overhead)
16Impact of Block Size
17Impact of Block Size
The diagrams show the overhead of the block
header, the object header, and the internal
fragmentation of a real-time reference counter
using 16, 32, and 64 byte blocks
16
Fragmentation
Object
Block
32
64
18Execution Time Comparison
S object size O memory overhead for dead
objects
19Implementations
- Real-Time Reference Counting has been
implemented - As CPP macros
- In the JOSES Java compiler
- In the Jamaica VM
- However more optimizations are required
- No backup GC has been implemented
20Benchmarks
b dividing objects into blocks bs spreading
the blocks r using reference counting t
running thousand simulations ( more blocks in
use)
21Future Work
- Full implementation
- RT-Mark compact
- Memory Usage Analysis
- Should critical systems use GC?
- Can you not explicitly deallocate all garbage if
you can give an upper bound of memory usage?
22Conclusion
- RT-Reference Counting drastically decrease the
memory overhead of real-time systems with a GC - The block size have a minor impact on the memory
overhead
23Increasing Memory Usage in Real-Time GC
- Tobias Ritzau and Peter Fritzson
- Department of Computer and Information Science
- Linköpings universitet
- tobri_at_ida.liu.se
- http//www.ida.liu.se/tobri