In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
JVM memory area what, I believe that many inexperienced people are helpless, this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
JVM memory area is mainly divided into thread private area [program counter, virtual machine stack, local method area], thread shared area [JAVA heap, method area], direct memory.
Thread private data areas have the same life cycle as threads, and are created/destroyed depending on the start/end of user threads (in Hotspot VM, each thread is directly mapped to a native thread of the operating system, so the existence/non-existence of this memory area follows the birth/death of the native thread).
Thread-sharing zones are created/destroyed with the startup/shutdown of virtual machines.
Direct memory is not part of the JVM runtime data area, but it is also frequently used: NIO introduced in JDK 1.4 provides a Channel and Buffer based IO mode, which can use the Native library to allocate out-of-heap memory directly and then use DirectByteBuffer objects as references to this memory (See Java I/O Extensions for details), this avoids copying data back and forth between Java heap and Native heap, and can significantly improve performance in some scenarios.
Program counter (thread private)
A smaller memory space is a line number indicator of the bytecode executed by the current thread. Each thread has a separate program counter. This type of memory is also called "thread private" memory.
If the java method is being executed, the counter records the address of the virtual machine bytecode instruction (the address of the current instruction). Empty if it is still Native.
This memory region is the only region in the virtual machine that does not specify any OutOfMemoryError cases.
Virtual machine stack (thread private)
Java is a memory model describing the execution of java methods. Each method creates a Stack Frame to store local variable tables, operand stacks, dynamic links, method exits, etc. Each method from invocation until execution is complete corresponds to a stack frame pushed to pop in the virtual machine stack.
Frame is a data structure used to store data and partial procedure results, and is also used to handle dynamic linking, method return values, and Dispatch exceptions. Stack frames are created with method invocations and destroyed with method termination--whether the method completes normally or abnormally (throwing an exception that is not caught within the method) counts as method termination.
Native Method Area (Thread Private)
Native method area and Java Stack function similar, the difference is that the virtual machine stack for the execution of Java method services, while the native method stack for the Native method services, if a VM implementation uses C-linkage model to support Native calls, then the stack will be a C stack, but HotSpot VM directly combines the native method stack and virtual machine stack into one.
Heap (Heap-thread sharing)-runtime data area
A memory area shared by threads. Objects and arrays created are stored in Java heap memory. It is also the most important memory area for garbage collection by garbage collector. Because modern VMs use generational collection algorithms, Java heaps can also be subdivided into Cenozoic (Eden, From Survivor, and To Survivor zones) and Old Ages from a GC perspective.
Method area/permanent generation (thread sharing)
That is, we often say the Permanent Generation (Permanent Generation), used to store class information loaded by the JVM, constants, static variables, code compiled by the just-in-time compiler and other data. HotSpot VM extends GC generational collection to the method area, i.e., implementing the method area as a permanent generation of the Java heap, so HotSpot's garbage collector can manage this memory just as it manages the Java heap, rather than having to develop a dedicated memory manager for the method area (the main goal of persistent band memory collection is collection and type unloading for constant pools, so the benefit is generally small).
The Runtime Constant Pool is part of the Methods section. In addition to the version, field, method, interface description and other information of the class, there is also a constant Pool Table, which is used to store various literals and symbol references generated during compilation. This part of the content will be stored in the runtime constant pool of the method area after the class is loaded. The Java virtual machine has strict rules on the format of each part of the Class file (naturally including the constant pool), and each byte used to store which data must meet the requirements of the specification, so that it can be recognized, loaded and executed by the virtual machine.
After reading the above, do you know what methods are available in the JVM memory area? If you still want to learn more skills or want to know more related content, welcome to pay attention to the industry information channel, thank you for reading!
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.