当前位置:网站首页>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 .
边栏推荐
- Principle and performance analysis of lepton lossless compression
- 【TFLite, ONNX, CoreML, TensorRT Export】
- Reinforcement learning - learning notes 3 | strategic learning
- Check the debug port information in rancher and do idea remote JVM debug
- 投资理财适合女生吗?女生可以买哪些理财产品?
- MySQL regular expression
- Multi table operation - sub query
- What is digital existence? Digital transformation starts with digital existence
- MySQL basic operation -dql
- The solution of outputting 64 bits from printf format%lld of cross platform (32bit and 64bit)
猜你喜欢
MySQL splits strings for conditional queries
Simple production of wechat applet cloud development authorization login
The survey shows that traditional data security tools cannot resist blackmail software attacks in 60% of cases
Simply solve the problem that the node in the redis cluster cannot read data (error) moved
Uniapp + unicloud + Unipay realize wechat applet payment function
多表操作-自关联查询
Principle of persistence mechanism of redis
Redis master-slave mode
[singleshotmultiboxdetector (SSD, single step multi frame target detection)]
Reinforcement learning - learning notes 3 | strategic learning
随机推荐
Get all stock data of big a
[mainstream nivida graphics card deep learning / reinforcement learning /ai computing power summary]
Sentinel sentinel mechanism of master automatic election in redis master-slave
Swift - add navigation bar
MySQL constraints
GPS數據格式轉換[通俗易懂]
2022年国内云管平台厂商哪家好?为什么?
[yolov3 loss function]
Liunx prohibit Ping explain the different usage of traceroute
The survey shows that traditional data security tools cannot resist blackmail software attacks in 60% of cases
Which domestic cloud management platform manufacturer is good in 2022? Why?
One article tells the latest and complete learning materials of flutter
Simply solve the problem that the node in the redis cluster cannot read data (error) moved
Swift - enables textview to be highly adaptive
Take you two minutes to quickly master the route and navigation of flutter
Understand kotlin from the perspective of an architect
Matlab superpixels function (2D super pixel over segmentation of image)
Intern position selection and simplified career development planning in Internet companies
【TFLite, ONNX, CoreML, TensorRT Export】
【PyTorch预训练模型修改、增删特定层】