Presentation is loading. Please wait.

Presentation is loading. Please wait.

Increasing Memory Usage in Real-Time GC Tobias Ritzau and Peter Fritzson Department of Computer and Information Science Linköpings universitet

Similar presentations


Presentation on theme: "Increasing Memory Usage in Real-Time GC Tobias Ritzau and Peter Fritzson Department of Computer and Information Science Linköpings universitet"— Presentation transcript:

1 Increasing Memory Usage in Real-Time GC Tobias Ritzau and Peter Fritzson Department of Computer and Information Science Linköpings universitet tobri@ida.liu.sehttp://www.ida.liu.se/~tobri

2 27-9 October, 2002Increasing Memory Usage in Real-Time GC The 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

3 37-9 October, 2002Increasing Memory Usage in Real-Time GC Mark-Sweep Root

4 47-9 October, 2002Increasing Memory Usage in Real-Time GC Buffer for Dead Objects

5 57-9 October, 2002Increasing Memory Usage in Real-Time GC Buffer for Dead Objects

6 67-9 October, 2002Increasing Memory Usage in Real-Time GC RT-Copying

7 77-9 October, 2002Increasing Memory Usage in Real-Time GC RT-Mark-Sweep (JamaicaVM)

8 87-9 October, 2002Increasing Memory Usage in Real-Time GC Available 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% Copying GC: 25% Mark-Sweep (JamaicaVM):31% Mark-Sweep (JamaicaVM):31% Reference Counting:47% Reference Counting:47%

9 97-9 October, 2002Increasing Memory Usage in Real-Time GC Reference Counting 1 1 1 2 1 2 1 10 0 Root 1 2 0 0 1

10 107-9 October, 2002Increasing Memory Usage in Real-Time GC Reference Counting Disadvantages to overcome Recursive freeing Recursive freeing External fragmentation External fragmentation Reclaiming dead cyclic data structures Reclaiming dead cyclic data structures Execution speed Execution speed

11 117-9 October, 2002Increasing Memory Usage in Real-Time GC Recursive 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…

12 127-9 October, 2002Increasing Memory Usage in Real-Time GC External 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 Weizenbaum’s technique to eliminate recursive freeing can be used on the blocks

13 137-9 October, 2002Increasing Memory Usage in Real-Time GC Dead Cyclic Data Structures Manual techniques cover most cases Breaking cycles Breaking cycles Weak references Weak references Balloon types Balloon types Automatic techniques are not real-time A backup real-time mark-sweep GC can be used but that increases memory overhead

14 147-9 October, 2002Increasing Memory Usage in Real-Time GC Execution Time Peep hole optimization Stack allocation Object owning (Data flow analysis)

15 157-9 October, 2002Increasing Memory Usage in Real-Time GC RT-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)

16 167-9 October, 2002Increasing Memory Usage in Real-Time GC Impact of Block Size

17 177-9 October, 2002Increasing Memory Usage in Real-Time GC Impact 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 3264 Block Object Fragmentation

18 187-9 October, 2002Increasing Memory Usage in Real-Time GC Execution Time Comparison RT Copying RT Mark-Sweep RTRC AllocationO(s+1/o)O(s+1/o)O(s) AccessO(1)O(s)O(s) S = object size O = memory overhead for dead objects

19 197-9 October, 2002Increasing Memory Usage in Real-Time GC Implementations Real-Time Reference Counting has been implemented: As CPP macros As CPP macros In the JOSES Java compiler In the JOSES Java compiler In the Jamaica VM In the Jamaica VM However more optimizations are required No backup GC has been implemented

20 207-9 October, 2002Increasing Memory Usage in Real-Time GC Benchmarks b= dividing objects into blocks bs= spreading the blocks r= using reference counting t= running thousand simulations (= more blocks in use)

21 217-9 October, 2002Increasing Memory Usage in Real-Time GC Future Work Full implementation RT-Mark compact Memory Usage Analysis Should critical systems use GC? Should critical systems use GC? Can you not explicitly deallocate all garbage if you can give an upper bound of memory usage? Can you not explicitly deallocate all garbage if you can give an upper bound of memory usage?

22 227-9 October, 2002Increasing Memory Usage in Real-Time GC Conclusion 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

23 Increasing Memory Usage in Real-Time GC Tobias Ritzau and Peter Fritzson Department of Computer and Information Science Linköpings universitet tobri@ida.liu.sehttp://www.ida.liu.se/~tobri


Download ppt "Increasing Memory Usage in Real-Time GC Tobias Ritzau and Peter Fritzson Department of Computer and Information Science Linköpings universitet"

Similar presentations


Ads by Google