Thomas Schatzl, Laurent Daynes, Hanspeter Mössenböck,
"Optimized Memory Management for Class Metadata in a JVM"
, in Wimmer, Probst: Proceedings of the 9th International Conference on the Principles and Practice of Programming in Java, ACM, Seite(n) 151-160, 2011, ISBN: 978-1-4503-0935-6
Optimized Memory Management for Class Metadata in a JVM
Sprache des Titels:
Proceedings of the 9th International Conference on the Principles and Practice of Programming in Java
A Java virtual machine (JVM) typically manages large amounts of class metadata (e.g. class descriptors, methods, byte codes) in main-memory. In this paper, we analyze the impact of metadata memory management on garbage collection costs in an industrial-strength JVM. We show that, for most applications in the latest DaCapo benchmark suite, the tracing of class metadata accounts for a significant part of full collection time.
We propose a novel approach to metadata memory management based on metaspaces and on a linkset graph. Metaspaces store class metadata segregated by their class loader and keep an exact record of references from class metadata to the heap. The linkset graph summarizes what metaspaces reference others via resolved symbolic links. Metaspaces allow en masse reclamation of the storage allocated to classes defined by a class loader when this class loader becomes unreachable. The linkset graph eliminates the need to trace references between metadata to determine the liveness of classes and of the heap objects they refer to.
This reduces the number of visited references in class metadata to less than 1% of the original amount and cuts down tracing time by up to 80%. Average full heap collection time improves by at least 35% for all but one of the Dacapo benchmarks, and by more than 70% for six of them.
Metaspace-based management of class metadata also extends well to multi-tasking implementations of the JVM. It enables tasks to unload classes independently of other tasks.