JMAP

Exception when taking a heapdump using JMAP

自闭症网瘾萝莉.ら 提交于 2019-12-01 15:46:04
I get the following exception when i take a heapdump using jmap -F -dump:format=b,file=/tmp/heapdump/before.hprof 10737 Attaching to process ID 10737, please wait... Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at sun.tools.jmap.JMap.runTool(JMap.java:179) at sun.tools.jmap.JMap.main(JMap

堆内存溢出排查

隐身守侯 提交于 2019-12-01 12:03:55
生成hprof文件 ①,top出异常进程 ②,生成异常进程的dump文件 jmap -dump:format=b,file=[文件名] [进程] jmap -dump:format=b,file=heap.hprof 2576 ③,使用JProfiler分析hprof 文件 使用JProfiler分析大对象 ①,导入:session->open snapshot ②,查看大对象:Heap Walker -> Current Object Set ->Giggest Object 来源: https://www.cnblogs.com/wanhua-wu/p/11684716.html

利用jmap和MAT等工具查看JVM运行时堆内存

天涯浪子 提交于 2019-12-01 05:13:01
jmap JDK自带了一些工具可以帮助我们查看JVM运行的堆内存情况,常用的是 jmap 命令 如果想学习Java工程化、高性能及分布式、深入浅出。微服务、Spring,MyBatis,Netty源码分析的朋友可以加我的Java高级交流:854630135,群里有阿里大牛直播讲解技术,以及Java大型互联网技术的视频免费分享给大家。 jmap -heap <pid> 打印堆的使用情况 那么,从这个输出中我们也可以大致看出堆的结构,分为Young Generation (年轻代) 和 Old Generation (老年代) Young Generation又被划分为:Eden Space , From Space 和 To Space 可以看到这里To区是干净的,还未被使用,From区已经使用了95%了 jmap -histo[:live] <pid> 打印类的实例数量、占用的内存、类的名称,通常我们并不需要看所有的,只需要看前几条即可 jmap -dump:live,format=b,file=heap.bin <pid> 以hprof二进制格式dump堆的使用情况(PS:相当于生成一个快照,后续我们可以对这个快照文件进行分析) Memory Analyzer (MAT) 文件dump下来以后,可以使用Eclipse的MAT插件进行查看 如果日常开发用的是eclipse的话

linux-buff/cache过大导致内存不足-程序异常

风流意气都作罢 提交于 2019-11-30 22:50:23
问题描述 Linux内存使用量超过阈值,使得Java应用程序无可用内存,最终导致程序崩溃。即使在程序没有挂掉时把程序停掉,系统内存也不会被释放。 找原因的过程 这个问题已经困扰我好几个月了,分析过好多次都没有找到原因,网上查了一下该问题其他人也都遇到过,不过并没有什么好的解决方案,因为项目一直没有上线,每次当内存不足时导致程序崩溃都是重启服务就好了,索性也就没花太多的时间来找问题。现在项目马上上线了,不能在出现程序崩溃的情况了,况且还是前置系统,更不能出现任何问题。 最开始一直认为是程序的原因导致内存泄漏,使用jdk自带的jmap -F -dump:live,format=b,file=/usr/local/sztFront/logs/heapdump.bin命令输出过几次dump文件,通过MemoryAnalyzer分析,应用程序没有耗内存过大的变量。后台猜测是否日志输出过多导致的,毕竟是前置系统,每天的报文量特别大,日志能到达5,6个G。所以把日志接收报文关了,日志大小马上降下来了,每天200M。程序挂掉的时间变长了,原来差不多一周就挂掉了,现在可以达到两周左右才挂掉,还是不行,没有冲根本上解决问题。经过在网上搜索各种相关的问题,问题出现在Cached的值过大,导致系统没有可以再分配的内存空间。Cached只要用来缓存文件的,经常读写的文件会被缓存到Cached中

Java : Get heap dump without jmap or without hanging the application

这一生的挚爱 提交于 2019-11-30 20:07:52
In few circumstance, our application is using around 12 GB of memory. We tried to get the heap dump using jmap utility. Since the application is using some GB of memory it causes the application to stop responding and causes problem in production. In our case the heap usage suddenly increases from 2-3 GB to 12GB in 6 hours. In an attempt to find teh memory usage trend we tried to collect the heap dump every one hour after restarting the application. But as said since using the jmap causes the application to hang we need to restart it and we are not able to get the trend of memory usage. Is

dump线程

吃可爱长大的小学妹 提交于 2019-11-30 18:02:07
1. 输出java进程pid ps -ef | grep java | grep -v 'grep ' | awk '{print $2}' 2. dump java 线程栈 jstack pid > jstack_dump.txt 3. dump java 内存 jmap -dump:format=b,file=jmap_dump.txt pid 来源: https://my.oschina.net/u/1000241/blog/3113518

3.深入jvm内核-原理、诊断与优化-6. 性能监控工具

穿精又带淫゛_ 提交于 2019-11-30 12:43:34
uptime 当前时间 1:01 系统已运行的时间 1:42 当前在线用户 3 user 平均负载:3.62, 3.39, 3.24,最近1分钟、5分钟、15分钟系统的负载 top jps 列出java进程,类似于ps命令 参数-q可以指定jps只输出进程ID ,不输出类的短名称 参数-m可以用于输出传递给Java进程(主函数)的参数 参数-l可以用于输出主函数的完整路径 参数-v可以显示传递给JVM的参数 jps 6260 Jps 7988 Main 400 jps -q 7988 7152 jps -m jps -m -l jps -m -l -v jinfo 可以用来查看正在运行的Java应用程序的扩展参数,甚至支持在运行时,修改部分参数 -flag <name>:打印指定JVM的参数值 -flag [+|-]<name>:设置指定JVM参数的布尔值 -flag <name>=<value>:设置指定JVM参数的值 显示了新生代对象晋升到老年代对象的最大年龄 jinfo -flag MaxTenuringThreshold 2972 -XX:MaxTenuringThreshold=15 显示是否打印GC详细信息 jinfo -flag PrintGCDetails 2972 -XX:-PrintGCDetails 运行时修改参数,控制是否输出GC日志 jinfo -flag

Locating code that is filling PermGen with dead Groovy code

给你一囗甜甜゛ 提交于 2019-11-30 12:16:13
问题 We have had our glassfish instance go down every two weeks for a while with a java.lang.OutOfMemoryError: PermGen space . I increased the PermGen space to 512MB and startet dumping memory usage with jstat -gc . After two weeks I came up with the following graph that shows how the PermGen space is steadily increasing (the units on the x-axis are minutes, y-axis are KB). I tried googling around for some kind of profiling tool that could pinpoint the error and a thread here on SO mentioned jmap,

我的java问题排查工具单

回眸只為那壹抹淺笑 提交于 2019-11-30 12:12:49
原文地址:https://yq.aliyun.com/articles/69520 我的问题排查工具箱 前言 平时的工作中经常碰到很多疑难问题的处理,在解决问题的同时,有一些工具起到了相当大的作用,在此书写下来,一是作为笔记,可以让自己后续忘记了可快速翻阅,二是分享,希望看到此文的同学们可以拿出自己日常觉得帮助很大的工具,大家一起进步。 闲话不多说,开搞。 Linux命令类 tail 最常用的tail -f tail -300f shopbase.log #倒数300行并进入实时监听文件写入模式 grep grep forest f.txt #文件查找 grep forest f.txt cpf.txt #多文件查找 grep 'log' /home/admin -r -n #目录下查找所有符合关键字的文件 cat f.txt | grep -i shopbase grep 'shopbase' /home/admin -r -n --include *.{vm,java} #指定文件后缀 grep 'shopbase' /home/admin -r -n --exclude *.{vm,java} #反匹配 seq 10 | grep 5 -A 3 #上匹配 seq 10 | grep 5 -B 3 #下匹配 seq 10 | grep 5 -C 3 #上下匹配,平时用这个就妥了

Why is my Java heap dump size much smaller than used memory?

 ̄綄美尐妖づ 提交于 2019-11-30 08:58:15
Problem We are trying to find the culprit of a big memory leak in our web application. We have pretty limited experience with finding a memory leak, but we found out how to make a java heap dump using jmap and analyze it in Eclipse MAT. However, with our application using 56/60GB memory, the heap dump is only 16GB in size and is even less in Eclipse MAT. Context Our server uses Wildfly 8.2.0 on Ubuntu 14.04 for our java application, whose process uses 95% of the available memory. When making the dump, our buffers/cache used space was at 56GB. We used the following command to create the dump: