当前位置:网站首页>Learn the memory management of JVM 02 - memory allocation of JVM
Learn the memory management of JVM 02 - memory allocation of JVM
2022-07-05 12:15:00 【The king of early rising】
Here's to say JVM Which parts of the memory is divided into , What are they .
The overview
As shown in the figure , Pictures come from books
—— In depth understanding of Java virtual machine :JVM Advanced features and best practices ( The first 3 edition ) Zhi-ming zhou

Here, the thread isolated data area intend Each thread has its own share .
The next? , We focus on the runtime data area , Whatever else .
Run time data area
Program counter
This is simpler , It is to mark which line the program executes , Which line should be executed next .
This may not make much sense in a single thread , But when multiple threads execute concurrently , His role is very important . When a thread executes an instruction , You need to switch other threads to execute , The current thread needs to be paused . To switch back to the thread , Be able to execute programs in the correct order , Need to mark line number .
Java Virtual machine stack
It is unique to each thread .
When each method is executed ,Java All virtual machines will create a stack frame synchronously . If you don't know stack frames , It's not accurate , It can be temporarily understood as an element in the stack . Stored in the stack frame is : Local variable table 、 The stack of operands 、 Dynamic connection 、 Method exit information . Method call , Stack frames are created , Push . Method execution completed , Out of the stack .
in other words , Virtual machine stack is method related .
Local variable table
Virtual machine stack , Part of the stack frame , More important , Take it out and say .
The local variable table stores 8 Big basic data types 、reference type and returnAddress type .
reference type yes Object reference
returnAddress type :
about JVM Come on , A program is a bytecode instruction stored in the method area , and returnAddress A value of type is a pointer to a specific instruction memory address .
above 10 All data types can be known at compile time .
Native Method Stack
Similar to virtual machine stack . The difference is that Virtual machine stack by Virtual machine execution Java Method service , The local method stack serves the local methods used by the virtual machine .
Java Pile up
Shared by all threads .
For storing object instances . Almost all object instances are stored here .
for instance :
Student Tom = new Student(); //Student It's a custom class Tom yes reference type , Store in the stack .
new Student() Is an object instance , Store in the pile .
From the point of view of allocating memory , All threads share Java In the pile , It can be divided into private allocation buffers for multiple threads , Used to improve the efficiency of object allocation . take Java The purpose of heap subdivision is to better reclaim memory , Or allocate memory faster .
Method area
Used to store... That has been loaded by the virtual machine Type information 、 Constant 、 Static variables 、 Real time compiler compiled code cache and other data .《Java Virtual machine specification 》 Zhongba Method area Described as one of the heaps Logical part , But it has an alias called “ Non heap ” The purpose is to Java Heap differentiation .
About method area , A little bit , Not much here , See :
All right. , That's all for the canto .
Keep early hours , take care . King of early rising , I wish you good luck .
边栏推荐
- MySQL constraints
- Halcon 模板匹配实战代码(一)
- MySQL multi table operation
- Time tools
- MySQL function
- Acid transaction theory
- Matlab imoverlay function (burn binary mask into two-dimensional image)
- Why learn harmonyos and how to get started quickly?
- Which domestic cloud management platform manufacturer is good in 2022? Why?
- Design of music box based on assembly language
猜你喜欢

What is digital existence? Digital transformation starts with digital existence
![[singleshotmultiboxdetector (SSD, single step multi frame target detection)]](/img/c7/8ad64582e09683818171b625769f37.png)
[singleshotmultiboxdetector (SSD, single step multi frame target detection)]

多表操作-自关联查询

【pytorch 修改预训练模型:实测加载预训练模型与模型随机初始化差别不大】

嵌入式软件架构设计-消息交互

Select drop-down box realizes three-level linkage of provinces and cities in China

Redirection of redis cluster

查看rancher中debug端口信息,并做IDEA Remote Jvm Debug

【SingleShotMultiBoxDetector(SSD,单步多框目标检测)】

Multi table operation - sub query
随机推荐
Reading notes of growth hacker
July Huaqing learning-1
Codeforces Round #804 (Div. 2)
MySQL index (1)
GPS数据格式转换[通俗易懂]
Halcon template matching actual code (I)
Error modulenotfounderror: no module named 'cv2 aruco‘
7月华清学习-1
一款新型的智能家居WiFi选择方案——SimpleWiFi在无线智能家居中的应用
Swift - enables textview to be highly adaptive
【ijkplayer】when i compile file “compile-ffmpeg.sh“ ,it show error “No such file or directory“.
Two minutes will take you to quickly master the project structure, resources, dependencies and localization of flutter
What is digital existence? Digital transformation starts with digital existence
Xi IO flow
16 channel water lamp experiment based on Proteus (assembly language)
leetcode:1200. Minimum absolute difference
[configuration method of win11 multi-user simultaneous login remote desktop]
GPS數據格式轉換[通俗易懂]
ABAP table lookup program
byte2String、string2Byte