java8使用Memory Analyzer大概是10左右的版本,用最新版本要java17
MemoryAnalyzer-1.10.0.20200225-win32.win32.x86_64
MAT(Memory Analyzer Tool)下载
https://www.cnblogs.com/zwh0910/p/15774590.html
Eclipse downloads - Select a mirror | The Eclipse Foundation
Eclipse Memory Analyzer Open Source Project | The Eclipse Foundation
Memory Analyzer使用教程 - 掘金
问题处理参考
记录flink taskmanager 生产环境 unable to create new native thread · 语雀
sudo vi /etc/security/limits.d/20-nproc.conf
* soft nproc unlimited
root soft nproc unlimited
* hard nproc unlimited
root hard nproc unlimited
ulimit -u
ulimit -u 65535
vi ~/.bash_profile
vi ~/.bashrc
~/.bash_profile 是交互式、login 方式进入 bash 运行的
~/.bashrc 是交互式 non-login 方式进入 bash 运行的
source ~/.bash_profile
sudo vi /etc/security/limits.conf
* soft nproc 65535
* hard nproc 65535
# 通过端口号确定进程号
netstat -tnlp |grep 52345
# 通过进程ID拉取dump
jmap -dump:format=b,file=~/flink-taskmanager.hprof 进程ID
国外文章
Troubleshoot OutOfMemoryError: Unable to Create New Native Thread - DZone
There is no room in the memory to accommodate new threads.
The number of threads exceeds the Operating System limit.
在线内存分析使用
高逼格可视化在线内存分析工具(Java Memory Head Dump Analyzer Tool)_在线分析dump_帅帅的Max的博客-CSDN博客
flink任务内存调优,TaskManager、JobManager内存配置_flink内存调优_大数据动物园的博客-CSDN博客
使用教程
https://www.cnblogs.com/trust-freedom/p/6744948.html
使用测试
public class OOMHeapTest {
public static void main(String[] args){
oom();
}
private static void oom(){
Map<String, OOMBean> map = new HashMap<String, OOMBean>();
Object[] array = new Object[1000000];
for(int i=0; i<1000000; i++){
String d = new Date().toString();
OOMBean o = new OOMBean(d, i);
map.put(i+"_oom", o);
array[i] = o;
}
}
private static class OOMBean {
private String d;
private Integer i;
public OOMBean(String d, int i) {
d=d;
i=i;
}
}
}
jvm参数设置
-Xms10m -Xmx10m -XX:+HeapDumpOnOutOfMemoryError
生成文件如下
用MA加载得到