In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what the JVM runtime area is like". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn what the JVM runtime area is like.
We know that JVM memory areas are: heap and stack, which is a general division and also a division according to the runtime region. The heap is an area shared by all threads, while the stack is thread-isolated and each thread does not share.
Threads do not share areas
The data area of each thread includes program counters, virtual machine stacks, and local method stacks, all of which are created when a new thread is created.
Program counter (Program Counter Rerister)
Program counter area A small area of memory used to store each execution instruction of a thread, each thread has its own program counter, and there is no memory overflow in this area.
Virtual machine stack (VM Stack)
Virtual machine stack describes the memory model of Java method execution. When each method is executed, a stack frame (Stack Frame) is created to store local variables, Operand stack, dynamic link, method exit and other information. The process that each method is called until the execution is completed corresponds to the process of a stack frame in the virtual machine stack from the stack to the stack.
Local method stack (Native Method Stack)
The local method stack is used to support local methods (methods identified by native, that is, methods that are not implemented in the Java language).
The virtual machine stack and the local method stack throw a StackOverflowError exception when the thread requests that the stack capacity allocated exceeds the maximum capacity allowed by JVM.
The area where threads do not share is shown in the green background of the following figure.
Thread sharing area
The thread sharing area contains the heap and the method area.
Heap (Heap)
The heap is the most commonly handled area, which stores arrays and objects created when JVM starts, and JVM garbage collection mainly works on the heap.
An OutOfMemoryError exception is thrown if the actual required heap exceeds the maximum capacity that the automatic memory management system can provide.
Method area (Method Area)
A method area is an area of runtime memory that can be shared by each thread. It stores structural information for each class, such as the runtime constant pool (Runtime Constant Pool), field and method data, bytecode contents of constructors and common methods, and special methods used in class, instance, and interface initialization.
When creating classes and interfaces, an OutOfMemoryError is thrown if the memory required to construct a runtime constant pool exceeds the maximum memory space that can be provided by the method area.
Run time Pool (Runtime Constant Pool)
The runtime pool is part of the method area, and each runtime pool is assigned to the method area of the JVM, and the corresponding runtime pool is created after the classes and interfaces are loaded into the JVM. The runtime constant pool is the runtime representation of the constant pool (Constant_Pool) for each class or interface, which includes several constants: the compiler literally takes a reference to a method or field that must be parsed at run time.
If the memory space in the method area does not satisfy the memory allocation request, the Java virtual machine will throw an OutOfMemoryError exception.
The stack contains the Frames, and when the method is called, the Frame is pushed to the stack. A Frame contains an array of local variables, Operand stacks, and constant pool references.
Thank you for your reading, the above is the content of "what the JVM runtime area is like". After the study of this article, I believe you have a deeper understanding of what the JVM runtime area is like, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.