当前位置:网站首页>JVM memory structure
JVM memory structure
2022-06-25 16:44:00 【Zhangzhiming (autumn recruit version)】

1. Which parts of the memory will overflow
① No memory overflow area - Program counter
② There are two types of memory overflows
Ⅰ appear OutOfMemoryError The situation of
1️⃣ Heap memory exhausted - More and more objects , Has been using , Can't be recycled
2️⃣ Method area out of memory - More and more classes are loaded , Many frameworks dynamically generate new classes during runtime
3️⃣ Virtual machine stack accumulation - Each thread will occupy up to 1M Memory , When there are more and more threads running for a long time without destroying
Ⅱ appear StackOverflowError Region
1️⃣ Inside the virtual machine stack - Too many method calls ( Recursion has no proper exit )
since Java The garbage collection mechanism can automatically reclaim memory , How can there be a memory leak ?
This problem , We need to know GC When to recycle memory objects , What kind of memory object will be GC Think it's “ No longer use ” Of .
Java Access to memory objects in , It's a way of quoting . stay Java In the code, we maintain a reference variable of the memory object , Through this reference variable's value , We can access the memory object space in the corresponding memory address . stay Java In the program , The reference variable itself can be stored in heap memory , It can also be placed in the memory of the code stack ( Same as basic data type ). GC The thread will start tracking from the reference variable in the code stack , To determine which memory is in use . If GC In this way, threads , Unable to trace to a certain heap memory , that GC I think this memory will no longer be used ( Because the code can no longer access this memory ).
Through this directed graph memory management , When a memory object loses all references ,GC You can recycle it . On the other hand , If there is a reference to this object , Then it will not be GC Recycling , Even if it is Java Virtual machine throw OutOfMemoryError .
java Since it exists gc Threads , Why is there a memory leak ? - THISISPAN - Blog Garden 1. since Java The garbage collection mechanism can automatically reclaim memory , How can there be a memory leak ? This problem , We need to know GC When to recycle memory objects , What kind of memory object will be GC Think it's “ No longer use ” Of . Java in https://www.cnblogs.com/panxuejun/p/5888817.html
Method area and permanent generation 、 The relationship between meta spaces
① The method area is JVM A block in the memory specification , Used to store class metadata 、 Method bytecode
Even if the compiler
② Permanent generation is Hotspot Virtual machines are right JVM Specification implementation (1.8 Before )
③ Metaspace is Hotspot Virtual machines are right JVM Specification implementation (1.8 after ), Use local memory
As a storage space for this information
JVM Memory parameters
about JVM Memory configuration parameters : -Xmx10240m -Xms10240m -Xmn5120m -XX:SurvivorRatio=3
Where the minimum memory value and Survivor The total size is
-Xmx:jvm Maximum number of memory 1024m:10g
-Xms:jvm Minimum memory for 1024m:10g
-Xms:jvm The number of new generation memory 5120m:5g
-XX:SurvivorRatio=3 eden:from=3 So the Cenozoic is divided into 5 Share eden3 from1 to1
therefore Survivor:2g 


边栏推荐
- 論文筆記:LBCF: A Large-Scale Budget-Constrained Causal Forest Algorithm
- 【精通高并发】深入理解C语言基础与汇编下的C语言
- When inputting text in the shutter textfield, if the page is refreshed, the cursor position will change.
- 深入理解和把握数字经济的基本特征
- Kalman Filter 遇到 Deep Learning : 卡尔曼滤波和深度学习有关的论文
- Notes: lbcf: a Large Scale budget Constrained causal Forest Algorithm
- Optimization of lazyagg query rewriting in parsing data warehouse
- Div element
- 根据先序遍历和中序遍历生成后序遍历
- AD域登录验证
猜你喜欢

Resolve the format conflict between formatted document and eslint

万卷书 - 大力娃的书单

Bypass technology to talk about 'cross end'

Go language - what is critical resource security?

Day_ twelve

What exactly is a handler

Unity技术手册 - 生命周期内大小(Size over Lifetime)和速度决定大小(Size by Speed)

DOM event flow, event delegate

心樓:華為運動健康的七年築造之旅

【NLP】今年英语高考,CMU用重构预训练交出134高分,大幅超越GPT3
随机推荐
10 Super VIM plug-ins, I can't put them down
Bugly hot update usage
心樓:華為運動健康的七年築造之旅
[100 questions of Blue Bridge Cup intensive training] scratch command mobile Blue Bridge Cup scratch competition special prediction programming question intensive training simulation exercise question
Go language - what is critical resource security?
Simple dialogue system -- implement transformer by yourself
Android修行手册之Kotlin - 自定义View的几种写法
居家办公让我绩效拿了C | 社区征文
Unity技术手册 - 生命周期旋转RotationOverLifetime-速度旋转RotationBySpeed-外力ExternalForces
JVM内存结构
3.条件概率与独立性
【機器學習】基於多元時間序列對高考預測分析案例
cmd。。。。。。
After flutter was upgraded from 2.2.3 to 2.5, the compilation of mixed projects became slower
Mysql database multi table query
Helsinki traffic safety improvement project deploys velodyne lidar Intelligent Infrastructure Solution
Learning notes of rxjs takeuntil operator
First knowledge of database
[proficient in high concurrency] deeply understand the basis of C language and C language under assembly
Prototype chain analysis