MAT :

怎么加载/这里边的一些概念 分别对应分析什么问题(泄露,线程,类加载器导致的泄露, 对象空间情况/

domain tree : 最大对象及谁持有它,保持存活的

histogram : 每个类数量和大小

  • outgoing reference

  • incoming reference

  • group by (class,superclass, ClassLoader, package ) 主要分析哪里可能泄露了

leak suspect : 泄露分析 和系统视图

path to gc roots :

  • These include for example the thread objects of the threads currently running, objects currently on the call stack and classes loaded by the system class loader.

栈视图 : 查看调用栈和栈详细信息

问题分析 :

  • Heap Dump Overview

  • Leak Suspects

  • Top Components

Heap Dump Overview

  • 就是整个堆的概括情况,例如:堆内存大小、对象个数、类的个数、类加载器的个数、GC root的个数、堆内存文件的格式、文件的创建时间、位置等信息。这个页面还开一个看一些系统属性、线程概览、Top内存耗费组件、类直方图等信息。

Top Components

  • 针对那些占用堆内存超过整个堆内存1%大小的组件做一系列的分析,例如:Top Consumers、保留集合、潜在的内存浪费问题等其他问题。

Shallow heap 对象本身空间占用/Retained set对象集合,集合被回收则其元素也被回收/Retained heap 对象集合中所有对象占用空间综合

修改MAT内存大小 : /Applications/mat.app/Contents/Eclipse/MemoryAnalyzer.ini

除了直接导入dump文件还可以直接获取正在运行的进程的

——————————————— END ————————————————————

模拟oom killer :

  • 关闭 swap

  • dd 占用内存空间

  • java不断开辟空间

-- 关闭swap :

swapoff -a

dd if=/dev/zero of=swapfile bs=1024 count=655360

mkswap swapfile

swapon swapfile

-- 执行命令 (注意参数放在前边 否则不生效)

java -Xms3g -Xmx3g -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/root/ -Xloggc:/root/gc-myapp.log 编译后你的类名

-- 被杀检测 :

tail -100f /var/log/messages

dmesg 或 dmesg|grep Kill

-- 查看得分 得分越高 越容易被kill

more /proc/19668/oom_adj

more /proc/19668/oom_score_adj

-- 可用内存 :

cat /proc/meminfo | grep MemAvailable

free -m

ps aux --sort -pmem

top -o %MEM

— java code :

public static List<Object> outOfHeadMem = new ArrayList<>();public static void main(String[] args) {allocateOutOfHeapMem();}public static void allocateOutOfHeapMem() {while (true) {try{Thread.sleep(100L);}catch (Exception ignored) {};int size = 1024 * 1024;System.out.printf("%s : capacity = %s\n", System.currentTimeMillis(), size);outOfHeadMem.add(ByteBuffer.allocateDirect(size));}}

是否允许超过物理内存:

echo 1 > /proc/sys/vm/overcommit_memory

overcommit_memory

Defines the conditions that determine whether a large memory request is accepted or denied. There are three possible values for this parameter:

0 — The default setting. The kernel performs heuristic memory overcommit handling by estimating the amount of memory available and failing requests that are blatantly invalid. Unfortunately, since memory is allocated using a heuristic rather than a precise algorithm, this setting can sometimes allow available memory on the system to be overloaded.

1 — The kernel performs no memory overcommit handling. Under this setting, the potential for memory overload is increased, but so is performance for memory-intensive tasks.

2 — The kernel denies requests for memory equal to or larger than the sum of total available swap and the percentage of physical RAM specified in overcommit_ratio. This setting is best if you want a lesser risk of memory overcommitment.

——————————————— END ————————————————————

MAT 分析OOM out of memory模拟OOM Killer相关推荐

  1. Android 内存管理 Memory Leak OOM 分析

    转载博客:http://blog.csdn.net/vshuang/article/details/39647167 1.Android 进程管理&内存 Android主要应用在嵌入式设备当中 ...

  2. java模拟内存溢出并分析_模拟内存溢出通过MAT分析

    构建一个简单的Springboot应用,模拟出OOM场景,再导出heap dump文件,通过Mat分析. 搭建简易Springboot,模拟OOM场景 搭建一个简易的springboot工程,在con ...

  3. 简述用 MAT 分析 Android 应用OOM

    OOM(OutOfMemoryError) 相信是所有 Android 开发者遇到的最多的 Error,因此找出个中缘由是非常重要. 这里用到的分析工具主要是 Eclipse MAT 插件http:/ ...

  4. MAT分析OOM dump文件方法

    系列文章目录 第一章 JVM 排查问题命令汇总 第二章 MAT分析OOM dump文件方法 第三章 Java服务使用CAT监控导致OOM的分析 目录 1.明确分析目标及分析指标 2.分析工具对比(jv ...

  5. Java内存溢出OOM使用Mat分析

    示例 package com.rumenz;import java.util.ArrayList; import java.util.List;public class OutOfMemory {pu ...

  6. 使用Memory Analyzer tool(MAT)分析内存泄漏(二)

    前言 在 使用Memory Analyzer tool(MAT)分析内存泄漏(一)中,我介绍了内存泄漏的前因后果.在本文中,将介绍MAT如何根据heap dump分析泄漏根源.由于测试范例可能过于简单 ...

  7. jvm性能分析工具之-- Eclipse Memory Analyzer tool(MAT)

    性能分析工具之-- Eclipse Memory Analyzer tool(MAT)(一) 前言 性能分析工具之-- Eclipse Memory Analyzer tool(MAT)(一)中介绍了 ...

  8. jvm性能分析工具之-- Eclipse Memory Analyzer tool(MAT)(二)

    前言 在本文中,将介绍MAT如何根据heapdump分析泄漏根源.由于测试范例可能过于简单,很容易找出问题,但我期待借此举一反三. 一开始不得不说说ClassLoader,本质上,它的工作就是把磁盘上 ...

  9. 使用Memory Analyzer tool(MAT)分析内存泄漏(一)

    使用Memory Analyzer tool(MAT)分析内存泄漏(一) (2010年05月21日) 发表于 Java博客 前言的前言 :本文是自 2005 年 8 月以来,首次在一个月之内发布三篇文 ...

最新文章

  1. 智源论坛Live丨青年科学家线上报告会日程发布
  2. 【转】窗口之间的主从关系与Z-Order
  3. linux uname内核,Linux下confstr与uname函数_获取C库与内核信息
  4. nat,acl及单臂路由实验(ensp)
  5. TSQLDBServerHttpApi使用工作线程池
  6. 用POP3获取邮箱邮件内容(完整C#源码)
  7. 电子商务网站PPT选择服务器,第8章 电子商务系统规划与建设课件.ppt
  8. 双目测距原理 matlab,双目测距的基本原理
  9. 电脑可以上网但打不开微信公众号
  10. php sendmail 抄送,Python发送邮件各种姿势
  11. 2012总结之pcode.Class
  12. vivo Y79的Usb调试模式在哪里,打开vivo Y79Usb调试模式的方法
  13. Python爬虫简单运用爬取代理IP
  14. 初探计算机视觉的三个源头、兼谈人工智能|正本清源
  15. Cygwin的简介以及使用方法
  16. [转载]中国传统武术的困境与出路----著名武术家张全亮答记者问
  17. 使用Quartus II9.0实现用74161计数器设计一个20进制的计数器
  18. Swift编程十二(方法)
  19. Python Mac 1
  20. C++最快速度改变字体颜色代码,VS2019实现

热门文章

  1. delphi 类class自定义类方法虚方法
  2. 这篇告诉你票据扫描软件哪个好
  3. HashMap底层原理全解析
  4. 【Java集合】一文快速了解HashMap底层原理
  5. win11:开始菜单打不开
  6. 阿里云效中软件缺陷种类及意思
  7. 2014025651 迟庆峰《嵌入式程序设计》第2周学习总结
  8. 低代码平台对于开发者来说可以解决哪些问题?
  9. 区块链共识机制技术二——POS(权益证明)共识机制
  10. 标准输出和标准错误重定向