当前位置:网站首页>JVM memory model parsing
JVM memory model parsing
2022-07-26 03:01:00 【ni?】
JVM Memory model analysis
Memory structure diagram :

public class Dome{
public static void main(String[] args){
Student stu = new Student();
stu.study();
stu.hash();
stu = null;
}
}
stay Dome The whole process of class operation :
1、Dome Class quilt javac Parsed into bytecode is JVM distinguish
2、 establish main Thread time , It takes up the memory of the virtual machine stack and starts running main Method
3、 If you encounter a class you haven't seen ( for example Dome、Student), Will continue to call the class loading process , The original information of the class ( The name of the class , Method 、 Inheritance relationships 、 Member variables, etc ) Storage method area
4、new object Student Store in the stack ( Memory size : Calculate the estimated memory occupied by member variables )
6、 When calling a method , Required temporary variables 、 Method parameters are stored in the stack frame memory of the virtual machine
7、 When calling a method , The bytecode instruction of the method will be obtained from the method area , The interpreter converts the bytecode into machine code and submits it to CPU perform
8、 When calling a method , The number of instruction lines being executed is stored in the program counter
9、 For virtual machine stacks and local method stacks ,java What is used Oracle Of Hotspot Virtual machines are not divided in detail , Call local method hash The memory of virtual machine stack is also used .
10、 When calling a method , Method called multiple times , The interpreter also calls many times, wasting resources , All hotspot methods will be compiled with an instant compiler
11、 When the object is no longer used , Triggered when out of memory GC Recycling mechanism reclaims heap memory space .
There will be memory overflow
Be careful : The program counter will not overflow memory
Throw out OutOfMemoryError error :
Heap memory : When objects are constantly created and occupied
Virtual machine stack : Each thread in the virtual machine stack accounts for 1M Memory , When the number of threads is increasing and running for a long time, it will not be destroyed
Method area : More and more classes are loaded
summary :
The method area is mainly responsible for storing the relevant information when the class is loaded
The virtual machine stack is responsible for threads 、 Temporary variable 、 Storage of temporary parameters
Heap is responsible for storing objects
The program counter is responsible for recording the location of the program
边栏推荐
- Is it safe to open galaxy securities account by mobile phone?
- 软件测试岗:阿里三面,幸好做足了准备,已拿offer
- 如何有效的去防止别人穿该网站首页快照
- Multithreaded programming
- [sql] case expression
- Continuous delivery and Devops are good friends
- 简单使用 MySQL 索引
- Self-supervised learning method to solve the inverse problem of Fokker-Planck Equation
- Pipnet: face key point detection for natural scenes "pixel in pixel net: directions efficient facial landmark detection in the wild"
- The sixth day of the third question of daily Luogu
猜你喜欢

Study notes of pytorch deep learning practice: convolutional neural network (Advanced)

Standardize your own debug process

VOFA+ 串口调试助手

(PC+WAP)织梦模板蔬菜水果类网站

AMD64(x86_64)架构abi文档:

Have you ever seen this kind of dynamic programming -- the stock problem of state machine dynamic programming (Part 1)

Nahamcon CTF 2022 babyrev reverse analysis

Stack Title: the longest absolute path of a file

测试/开发程序员老了怎么办?挥之不去残酷的事实......

MySQL build websites data table
随机推荐
ES6高级-利用原型对象继承方法
Basics - network and server
Multithreaded programming
1.软件测试-----软件测试的基本概念
如何加速矩阵乘法
MySQL tutorial: MySQL database learning classic (from getting started to mastering)
AMD64(x86_64)架构abi文档:中
图像识别(六)| 激活函数
How to speed up matrix multiplication
ES6高级-利用构造函数继承父类属性
Study notes of pytorch deep learning practice: convolutional neural network (Advanced)
massCode 一款优秀的开源代码片段管理器
eslint常见报错集合
FPGA_ Initial use process of vivado software_ Ultra detailed
Binary search 33. search rotation sort array
GoLang日志编程系统
一切的源头,代码分支策略的选择
pbootcms上传缩略图尺寸自动缩小变模糊
Self-supervised learning method to solve the inverse problem of Fokker-Planck Equation
HLS Experiment 1 -- multiplier