Inside a Java Virtual Machine instance, information about loaded types is stored in a logical area of memory area called the method area. When the Jave Virtual Machine loads a type, it uses a class loader to locate the appropriate class file. The class loader reads in the class file -- a linear stream to binary data and passes it to the virtual machine. Memory for class(static) variables declared in the class is also taken from the method area.
The method area can also be garbage collected. Because Java programs can be dynamically extended via class loader objects, classes can become "unreferenced" by the application. If a class becomes unreferenced, a Java Virtual Machine can unload the class(garbage collect it) to keep the memory occupied by the method area at a minimum.
Type Information: for each type it loads, a Java Virtual Machine must store the following kinds of information in the method area:
. the fully qualified name of the type
. the fully qualified name of the type's direct superclass
.whether or not the type is a class or an interface
. the type's modifiers(some sumbset of ' public , abstract, final)
.an ordered list of the fully qualified names of any direct superinterfaces.
In addition to basic type information listed above, it must also store for each loaded type:
. the constant pool for the type
. field information
. method information
.all class(static) variables declared in the type, except constants
.a reference to class ClassLoader
. a reference to Class Class
The method area can also be garbage collected. Because Java programs can be dynamically extended via class loader objects, classes can become "unreferenced" by the application. If a class becomes unreferenced, a Java Virtual Machine can unload the class(garbage collect it) to keep the memory occupied by the method area at a minimum.
Type Information: for each type it loads, a Java Virtual Machine must store the following kinds of information in the method area:
. the fully qualified name of the type
. the fully qualified name of the type's direct superclass
.whether or not the type is a class or an interface
. the type's modifiers(some sumbset of ' public , abstract, final)
.an ordered list of the fully qualified names of any direct superinterfaces.
In addition to basic type information listed above, it must also store for each loaded type:
. the constant pool for the type
. field information
. method information
.all class(static) variables declared in the type, except constants
.a reference to class ClassLoader
. a reference to Class Class
Comments
Post a Comment