One of the important advantages of Java, from a programmers prospectiv
e, is the use of garbage collection. One aspect of memory management i
n Java is that all objects are created on a garbage collected heap. On
ly primitive types, mostly numeric types and references to objects, ar
e allocated on the runtime stack. We speculated that a significant num
ber of objects behaved like traditional automatic variables, that are
normally allocated on the runtime stack. We instrumented a Java virtua
l machine to test this hypothesis. The percentage of objects that coul
d have been allocated on a stack instead of on the heap ranged from ze
ro to possibly as high as 56%, but were generally in the 5-15% range.