Reducing garbage in Java

  • Authors:
  • C. E. McDowell

  • Affiliations:
  • Computer Science Dept, University of California Santa Cruz

  • Venue:
  • ACM SIGPLAN Notices
  • Year:
  • 1998

Quantified Score

Hi-index 0.00

Visualization

Abstract

One of the important advantages of Java, from a programmers prospective, is the use of garbage collection. One aspect of memory management in Java is that all objects are created on a garbage collected heap. Only primitive types, mostly numeric types and references to objects, are allocated on the runtime stack. We speculated that a significant number of objects behaved like traditional automatic variables, that are normally allocated on the runtime stack. We instrumented a Java virtual machine to test this hypothesis. The percentage of objects that could have been allocated on a stack instead of on the heap ranged from zero to possibly as high as 56%, but were generally in the 5--15% range.