Comments (1)
Java内存问题,可以的检查操作有:
# 下面的这些都不方便做成脚本直接得出jvm中最大对象
。谁有方法脚本化 欢迎提供或是实现。 👍
查看不同类型占用的内存
$ jmap -histo <进程号> | head -n 20
num #instances #bytes class name
----------------------------------------------
1: 13352 60321384 [B
2: 108823 13516768 <constMethodKlass>
3: 89912 9476704 [C
4: 108823 8710200 <methodKlass>
5: 152780 6715552 <symbolKlass>
6: 8796 5325984 <constantPoolKlass>
7: 8796 4219536 <instanceKlassKlass>
8: 16753 3896104 [I
9: 7026 2782816 <constantPoolCacheKlass>
10: 109717 2633208 java.lang.String
11: 40391 969384 java.util.HashMap$Entry
12: 13806 932104 [Ljava.lang.Object;
13: 9400 902400 java.lang.Class
14: 8076 854312 [Ljava.util.HashMap$Entry;
15: 11426 794936 [S
16: 13935 685408 [[I
查看JVM内存消耗和GC情况
$ jstat -gcutil 17708 1000
S0 S1 E O P YGC YGCT FGC FGCT GCT
35.93 0.00 22.05 2.01 38.92 4 0.156 0 0.000 0.156
35.93 0.00 22.05 2.01 38.92 4 0.156 0 0.000 0.156
35.93 0.00 22.05 2.01 38.92 4 0.156 0 0.000 0.156
35.93 0.00 22.05 2.01 38.92 4 0.156 0 0.000 0.156
35.93 0.00 22.05 2.01 38.92 4 0.156 0 0.000 0.156
Dump内存,查看对象消耗
这个是 最直接准确的,当然操作也繁琐些。
$ jmap -dump:file=heap.bin <进程号>
Dumping heap to /path/to/heap.bin ...
Heap dump file created
然后用工具分析Dump文件,可以用工具MAT。一般很容易就看到内存泄漏对象。
通过查看对象引用关系,可以分析出内存泄漏的原因。
from useful-scripts.
Related Issues (20)
- 应用太多时(top: pid limit (20) exceeded) HOT 2
- 今天随便看到个文章就cue到鼎爷的 HOT 1
- /dev/stdout: Permission denied HOT 5
- 语法不对,请问怎么解决,是直接wget到服务器执行的 HOT 3
- show-busy-java-threads:why update 2 times HOT 4
- All of yours scripts are stand-alone programs! Why not BPKG? HOT 6
- linux中添加回收站(将rm改为mv) HOT 3
- show-busy-java-threads: jdk21没有展示stack信息 HOT 6
- ubuntu 系统 jdk21 统计不了 busy 栈 HOT 7
- uq: cannot save result to file | uq: 无法保存输出 HOT 1
- [1] Fail to jstack busy(48.0%) thread(32231/0x7de7) stack of java process(32170) under user(root). HOT 2
- 能实现windows版本吗? HOT 2
- SyntaxError: invalid syntax HOT 1
- show-busy-java-threads: jdk15 使用问题 HOT 3
- 使用 coat 命令执行*.sh文件,中文乱码 HOT 4
- show-busy-java-threads 可以后台启动吗? HOT 1
- who's using | 用户使用收集
- python脚本实现两个文本合并 HOT 3
- 文档中oldratlee.com的链接需要更新 HOT 1
- Unknown Source HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from useful-scripts.