What is Java Method Area?



JVM has a method area common across all the threads. It contains per-class elements like constant pool, fields, method local data, method code, constructor codes etc. which are used in class and initialization of objects/interfaces.

This method area gets created during JVM start-up. It is generally part of Heap area. It could be of fixed size or vary. Its memory may not be contiguous. JVM implementation can give control to programmer over Method area creation, its sizing etc. If method area memory is not sufficient to satisfy an allocation request then JVM throws OutOfMemoryError.




Advertisements