当前位置:网站首页>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 basic operation -dql
- What is the difference between canvas and SVG?
- 【yolov5.yaml解析】
- 只是巧合?苹果 iOS16 的神秘技术竟然与中国企业 5 年前产品一致!
- codeforces每日5题(均1700)-第五天
- II. Data type
- Read and understand the rendering mechanism and principle of flutter's three trees
- July Huaqing learning-1
- Get data from the database when using JMeter for database assertion
- Take you two minutes to quickly master the route and navigation of flutter
猜你喜欢
Embedded software architecture design - message interaction
Use and install RkNN toolkit Lite2 on itop-3568 development board NPU
Splunk configuration 163 mailbox alarm
How to clear floating?
强化学习-学习笔记3 | 策略学习
多表操作-自关联查询
什么是数字化存在?数字化转型要先从数字化存在开始
Yolov5 target detection neural network -- calculation principle of loss function
MySQL storage engine
Redis cluster (master-slave) brain crack and solution
随机推荐
Matlab boundarymask function (find the boundary of the divided area)
Xi IO flow
Liunx prohibit Ping explain the different usage of traceroute
Codeforces Round #804 (Div. 2)
Simple production of wechat applet cloud development authorization login
[pytorch pre training model modification, addition and deletion of specific layers]
Why learn harmonyos and how to get started quickly?
Take you two minutes to quickly master the route and navigation of flutter
mmclassification 训练自定义数据
Four operations and derivative operations of MATLAB polynomials
JS for循环 循环次数异常
vscode快捷键
Flutter2 heavy release supports web and desktop applications
【pytorch 修改预训练模型:实测加载预训练模型与模型随机初始化差别不大】
The solution of outputting 64 bits from printf format%lld of cross platform (32bit and 64bit)
Basic operations of MySQL data table, addition, deletion and modification & DML
A guide to threaded and asynchronous UI development in the "quick start fluent Development Series tutorials"
Codeworks 5 questions per day (1700 average) - day 5
报错ModuleNotFoundError: No module named ‘cv2.aruco‘
语义分割实验:Unet网络/MSRC2数据集