In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you about the structure of Java virtual machines. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1. The main structure of JVM is as follows:
Introduction of the functions of each region
1), method area (Method Area):
(1) it is used to store class information, constants and static variables loaded by virtual machines, which is the memory area shared by each thread.
(2) the default minimum value is 16MB and the maximum value is 64MB. You can limit the size of the method area by-XX:PermSize and-XX:MaxPermSize parameters.
(3) another part of the method area is the runtime constant pool, which is mainly used to store literals and symbolic references generated at compile time. Constants can also be generated at run time, such as String's intern method.
(4) like Java heap, you don't need contiguous memory and you can choose not to implement garbage collection except for fixed size or expandability.
2), stack:
(1) the Java virtual machine stack is private to threads and has the same life cycle as threads.
(2) when each method is executed, a stack frame (stack frame) is created at the same time, which is used to store local variable table, operation stack, dynamic link, method exit and other information. The execution of each method corresponds to the process of entering and leaving the stack frame in the stack. The stack frame consists of three parts: the local variable area, the Operand stack and the frame data area.
(3) the local variable table in the JVM virtual machine stack stores various basic data types that can be known at the time of compilation. The space needed by the local variable table is allocated at the compilation time.
(4) the stack frame is the basic data structure of the method runtime.
3), local method stack (Native Method Stack):
(1) the local method stack serves the Native method used by the JVM virtual machine.
There is no distinction between virtual machine stack and local method stack in HotSpot
4), Heap:
(1) the largest piece of memory managed by the Java virtual machine.
(2) the Java heap is an area shared by all threads and is created when the virtual machine starts.
(3) the only purpose of the memory area is to store object instances, and all object instances and arrays allocate memory on the heap.
(4) Java heap is the main memory area managed by JVM garbage collection mechanism, and Java heap can be located in discontiguous memory space.
5), program counter:
(1) A relatively small memory space that can be seen as a line number indicator of the bytecode executed by the current thread
(2) when the bytecode interpreter works, it depends on the program counter to select the next bytecode instruction, branch, loop, jump, exception handling, thread recovery and so on.
6). Running constant pool:
(1) the running time pool is part of the method area.
(2) in addition to the version, field, method interface description and other information of the class in the Class file, another piece of information is constant pool, which is used to store various literals and symbol references generated during compilation. This part of the content will be loaded in the class.
It is then stored in the runtime constant pool in the method area.
7), direct memory:
Because Java introduces NIO and introduces the IO mode of channels and buffers, you can call the Native method to allocate out-of-heap memory directly. This out-of-heap memory is native memory and will not affect the heap memory size.
Thank you for reading! This is the end of this article on "what is the structure of the Java virtual machine?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
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.