JVM Method Area


Method Area

Method Area is a defined memory section in the HEAP, where the class data is stored when the first time a Class is referenced by the Java application and loaded by the Class Loader. The size of the Method Area is not fixed. As the Java application runs, the JVM can expand and contract the Method Area to fit the application's need. The memory of the method area need not be contiguous. The Method Area is shared among all JVM threads. The memory allocated for an object usually includes some kind of pointer into the method area for that Object to access its Class data.

The Method Area holds the following Class data of the loaded TYPE:


  • The fully qualified name of the TYPE.
  • The fully qualified name of the TYPE’s direct Superclass, unless the type is an Interface or Class (java.lang.Object), as neither of them have a Superclass.
  • A flag identifying the TYPE as a Class or an Interface.
  • The TYPE's modifiers.
  • An ordered list of the fully qualified names of any direct Super-Interfaces.
  • The Constant Pool for that TYPE.
  • Field information.
  • Method information:
    • The Method's name.
    • The Method's return type or void.
    • The number and types (in order) of the Method's parameters.
    • The Method's modifiers.
    • Method Data.
  • Static variable contents of the Method.
  • A reference to the Class Loader which loaded the Method.
  • A reference to class Class.
  • Method Table (A method table is an array of direct references to all the instance methods that may be invoked on a class instance, including instance methods inherited from Super-Classes).


No comments:

Post a Comment