Download presentation
Presentation is loading. Please wait.
Published byLizbeth Daniel Modified over 9 years ago
1
Exploiting Prolific Types for Memory Management and Optimizations By Yefim Shuf et al.
2
Roadmap What is prolific types? –Properties of prolific types Applications –Type-based garbage collection –Reducing memory consumed by objects –Object co-allocation –Locality-based traversal Conclusions
3
Prolific Types Observation: –Relatively few object types usually account for a large percentage of objects (and heap space) These frequently instantiated types are prolific types Others are non-prolific types
4
Identifying Prolific Types Offline profiling –Dump information in a file Adaptive approach –Collect info during execution –Sampling Compile-time –May be possible
5
Checking a Variable for Prolific Type Given “T o” –Object o is prolific if all subclasses of T are prolific –Need class hierarchy analysis Check added at compile time –Handle dynamic loading A simple heuristic –Prolific types are likely leaves or close to leaves Treat all children of prolific types as prolific
6
Application 1 :Type-based Memory Management Objects of prolific types have short lifetimes –Resemble nature: offspring of prolific species are often short- lived Heap space partitioned into two regions –P-region: objects of prolific types –NP-region: objects of non-prolific types Collection –Perform frequent minor collection only in the P-region – In frequent full collection –Survivors of P-region collection stay in P-region Compared to generation collection –Write barriers needed to remember pointer from NP-region to P- region
7
Additional Advantages Compile-time write barrier elimination –Eliminate barrier that are not pointing from NP to P P-region Collection Processing –Only need to scan pointers to P-region Methods return two reference list –One full list –One partial list: references to prolific objects
8
Results: write barrier
9
Results: Throughput
10
Results: GC Times
11
Application 2: Short Type Pointers Observation: The number of prolific types is small –Mostly <= 16 Application –Shorten object headers –Using a 4-bit field to encode TIB The value is an index to the table of real TIBs
12
Results: statistics on prolific types
13
Results: Space Saving
14
Application 3: Object Co-allocation Properties –Objects of prolific types tend to access together –The large number of prolific objects denote potential benefit Co-allocate objects of prolific types –Improve spatial locality –Reduce GC times with improved GC-time locality –Reduce memory fragmentation Objects born together tend to die together
15
The Co-allocation Algorithm Create a directed graph –Nodes: types –Edges: from a (source) type to a type of the source’s reference field P-edge: prolific type to prolific type NP-edge: non prolific type to non prolific-type Others Co-allocation –Partition the graph into clusters –Each cluster is a set of nodes linked by P-edges –When one node (representative node) of a cluster is allocated, reserve enough space for other nodes in cluster –In practice, each cluster consists of two nodes
16
Locality-based Traversal Divide heap into chunks Visit the objects in to same chunk before those in other chunks –Improve GC locality –Can improve locality when combined with a copy collector
17
The Locality-based Traversal Algorithm
18
Implementation Issues Choice of chunk size –No bigger than the physical memory of a process Which chunk to collect first? –Last chunk allocated (may still in cache) Which pointer to choose from LP? –Choose an object close to the one visited recently Which chunk next? –With most reachable objects by sampling –A pointer into the chunk closest to the current chunk
19
Results: non-copy GC
20
Results: Copying GC
21
Conclusions Prolific type based GC perform better than a generational GC With encode prolific types, heap space reduced Proliflic objects co-allocation improve performance with non-copying GC Locality-based GC traversal has positive impacts on copying GC
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.