JVM memory consist of heap , non-head and other
heap: which is the storage for java objects and array
堆存储对象和数组
non-heap: which is used by java to store loaded classs and other metadata
非堆存储class和meta信息
other: JVM code itself, JVM internal strcutures, loaded profiler agent code and data, etc
heap is the runtime data area from which memory for all class instances and array allocated. It created at the JVM start-up.
the heap size may be configured with the following VM options
-Xms: to set the initial java heap size 初始化大小
-Xmx: to set the maximum java heap size 最大值
By default, the maximum size is 64Mb
heap memory for objects is reclaimed by an automatic management system which is known as Garbage Collector. The heap may be a fixed of szie or expanded and shrunk, depending on the GC's strategy
head中的对象被GC回收
heap: 分为3个区
eden: new object
survivor(2): after GC operation still survivor
old generation: long lifecycle
eden和2个survivor组成新生代。
young generation consist of eden, and 2 survivor, have one survivor is always empty.
when young generation is full, then trigger minor collection(YGC), the survivor objects will move to tenured generation. Last when tenured generation is full, the cause magor collection(Full GC), it will collect all heap, incude young generation. permanent generation is stable, store classLoader info.
当新生代满了,则执行YGC把survivor里面的对象移到old中。如果old满了,则执行full GC,对整个堆进行回收。permanet一般不变。
non-heap
store the per-class structure, such as runtime constant pool, field and method data, and the code for method and contructors, as well as interned String
非堆存放class结构信息,常量池,字段方法等信息。
configure
-XX:PermSize 初始化大小
-XX:MaxPermSize(default 64Mb) 最大值
non-heap:分为2个区
permanent generation: store class, method and field
code cache: compile and store native code and do optimize
JVM运行时数据的区域:
PC寄存器
JVM支持多个线程,每个线程都有自己的pc寄存器,如果线程执行的方法不是本地方法,则pc寄存器存储当前线程执行方法的地址,若为Native,则未定义。
JVM方法栈
线程私有,描述java方法调用是的内存模型。每个方法被执行的时候都会创建帧栈,用于存储局部变量,操作栈,动态链接,方法出口等信息。有时候会粗分栈,堆,栈就是指这里的栈。而在线程中有个工作内存和主内存,这个jvm栈是线程私有,所以这里的工作内存指这里。
本地方法栈:为虚拟机使用到的Native方法服务
JVM堆:存放对象实例和数组
方法区(非堆):存放class的结构信息,包括常量池,字段描述,方法描述。这里的GC主要对常量池的回收和类的卸载。
java内存溢出问题:
java.lang.OutOfMemoryError:java heap space. JVM heap溢出
调节-Xmx大小
java.lang.OutOfMemoryError:PermGen space.
调节-XX:MaxPermSize大小
java.lang.StackOverflowError:栈溢出
调节-Xss大小
查看线程
jvisualVM
查看内存运行情况
jconsole
查询jvm进程id
jps
分享到:
相关推荐
jvm memory
JVM Memory Model and GC.pdf
很久之前就一直在学习JVM,但是一直也没有好好的总结,最近终于有了空闲,将之前学习的内容整理成了一个PPT。PPT也可以在这里下载: https://github.com/hitynsun/docs/tree/master/JVM 也希望大神们可以批评指正...
JVM Debugger Memory View for Android Studio
在Jconsole框架顶部编写的应用程序可以用作Applet,App,JWS等,并带有http通讯API来监视防火墙后面的远程应用程序。
jvm性能调优-jvm内存模型和优化-performance-jvm-memorymodel-optimize
MemoryAnalyzer-jvm内存分析工具,可以将转储的dump文件解析成图形化,能够清晰的看到项目的内存占用情况以及gc回收详情
MemoryAnalyzer JVM堆内存分析工具
HotSpot JVM Memory Management
(MaxProcessMemory - JVMMemory - ReservedOsMemory) / (ThreadStackSize) = Number of threads 对于jdk1.5而言,假设操作系统保留120M内存: 1.5GB JVM: (2GB-1.5Gb-120MB)/(1MB) = ~380 threads 1.0...
Java virtual machine memory management and tuning
2.take a deep look inside the JVM memory management model 3.introduce how to choose a suitable GC strategy and how to configure your JVM for your application 4.introduce the key options for JVM ...
JVM内存dump分析工具MAT独立安装包,分析内存溢出利器,可以准确定位内存异常原因,解决问题,MemoryAnalyzer-1.10.0.20200225.zip
JVM异常分析文件
在这里可以看到当前 Tomcat7 的 JVM 内存使用情况,包括 Free memory、Total memory 和 Max memory 等信息。 四、添加 Tomcat7 用户 Tomcat7 中缺少默认用户,因此需要手动添加用户。可以在 tomcat-users.xml 文件...
Tracing the internal memory usage of Java Virtual Machine (JVM) by Native Memory Tracking (NMT)
MemoryAnalyzer主要用于分析jvm运行过程中导致内存溢出、内存泄漏的工具,MemoryAnalyzer主要用于分析jvm运行过程中导致内存溢出、内存泄漏的工具,MemoryAnalyzer主要用于分析jvm运行过程中导致内存溢出、内存泄漏...
Memory Analyzer Tool(MAT)工具是 eclipse 的一个插件(MAT 也可以单独使用),它分析大内存的 dump 文件时,可以非常直观的看到各个对象在堆空间中所占用的内存大小、类实例数量、对象引用关系、利用 OQL 对象查询,...
问候,Java时髦! 这是JHipster React实用程序库 完整的文档和信息可在我们的网站上找到,网址为 提交问题之前,请阅读我们的。 如果您的问题是错误,请使用预先填充的错误模板。 对于功能请求和查询,可以使用。...
OOM分析工具-MemoryAnalyzer JVM dump分析利器