2

Possible Duplicate:
static allocation in java - heap, stack and permanent generation

Looking to understand what EXACTLY happens (in terms of memory management) when a class is loaded by JVM. Specifically:

  • Which part of memory is the actual class byte code loaded/placed?
  • Which part of memory are the static variables loaded/placed?
  • Which part of memory are the other variables and methods loaded/placed?
Community
  • 1
  • 1
Saket
  • 45,521
  • 12
  • 59
  • 79

1 Answers1

0

At first the byte array containing the class is loaded into PermGen.

Then the classes byte array is parsed and some parsed information is placed into PermGen, too.

Then the Strings in the class are internalized (and placed into PermGen).

When the class is initialized, all static variable instances are placed on the heap.

When functions are called more often than a given threshold, the code for the JIT-compiled functions is placed into PermGen, too.

That should be all, AFAIK, but I am not a JVM developer.

Daniel
  • 27,718
  • 20
  • 89
  • 133