当前位置:网站首页>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 data table operation DDL & data type
- 【L1、L2、smooth L1三类损失函数】
- 1. Laravel creation project of PHP
- Swift - add navigation bar
- How to clear floating?
- MySQL multi table operation
- Ncp1342 chip substitute pn8213 65W gallium nitride charger scheme
- Linux Installation and deployment lamp (apache+mysql+php)
- Error modulenotfounderror: no module named 'cv2 aruco‘
- IPv6与IPv4的区别 网信办等三部推进IPv6规模部署
猜你喜欢
MySQL splits strings for conditional queries
[singleshotmultiboxdetector (SSD, single step multi frame target detection)]
Network five whip
7月华清学习-1
报错ModuleNotFoundError: No module named ‘cv2.aruco‘
HiEngine:可媲美本地的云原生内存数据库引擎
[configuration method of win11 multi-user simultaneous login remote desktop]
Pytorch softmax regression
mysql拆分字符串做条件查询
ABAP table lookup program
随机推荐
Why learn harmonyos and how to get started quickly?
Which domestic cloud management platform manufacturer is good in 2022? Why?
byte2String、string2Byte
Pytorch MLP
Simple production of wechat applet cloud development authorization login
【主流Nivida显卡深度学习/强化学习/AI算力汇总】
[cloud native | kubernetes] actual battle of ingress case (13)
Principle of persistence mechanism of redis
Codeforces Round #804 (Div. 2)
Read and understand the rendering mechanism and principle of flutter's three trees
多表操作-子查询
Get all stock data of big a
MySQL function
Tabbar configuration at the bottom of wechat applet
【TFLite, ONNX, CoreML, TensorRT Export】
A guide to threaded and asynchronous UI development in the "quick start fluent Development Series tutorials"
Check the debug port information in rancher and do idea remote JVM debug
codeforces每日5题(均1700)-第五天
只是巧合?苹果 iOS16 的神秘技术竟然与中国企业 5 年前产品一致!
自动化测试生命周期