Optimized memory management for class metadata in a JVM

  • Authors:
  • Thomas Schatzl;Laurent Daynès;Hanspeter Mössenböck

  • Affiliations:
  • Johannes Kepler University Linz;Oracle Labs;Johannes Kepler University Linz

  • Venue:
  • Proceedings of the 9th International Conference on Principles and Practice of Programming in Java
  • Year:
  • 2011

Quantified Score

Hi-index 0.00

Visualization

Abstract

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.