Java本机内存使用情况 [英] Java native memory usage
问题描述
有没有工具可以知道我的java应用程序使用了多少本机内存?
我从我的应用程序中经历过outofmemory:
当前设置为:
-Xmx900m
Is there any tool to know how many native memory has been used from my java application ? I've experienced outofmemory from my application : Current setting is : -Xmx900m
计算机,Windows 2003 Server 32位,RAM 4GB。
Computer, Windows 2003 Server 32bit, RAM 4GB.
同样在windows上将boot.ini更改为/ 3GB,会有什么不同吗?
如果设置为Xmx900m,可以为此进程分配多少最大本机内存?它是1100米?
Also is changing boot.ini to /3GB on windows, will make any difference? If is set Xmx900m, how much max native memory can be allocated for this process ? is it 1100m ?
推荐答案
(在我的情况下,我使用的是java 8)
(in my case I use java 8)
添加到命令行: -XX:NativeMemoryTracking = summary
然后启动 jcmd< PID> VM.native_memory
你应该得到这样的东西:
You should get something like this:
Total: reserved=3863657KB, committed=1679977KB
- Java Heap (reserved=1843200KB, committed=824320KB)
(mmap: reserved=1843200KB, committed=824320KB)
- Class (reserved=1311974KB, committed=298726KB)
(classes #52579)
(malloc=5350KB #76340)
(mmap: reserved=1306624KB, committed=293376KB)
- Thread (reserved=263278KB, committed=263278KB)
(thread #256)
(stack: reserved=262140KB, committed=262140KB)
(malloc=839KB #1280)
(arena=299KB #510)
- Code (reserved=278521KB, committed=164773KB)
(malloc=28921KB #37983)
(mmap: reserved=249600KB, committed=135852KB)
- GC (reserved=114897KB, committed=77093KB)
(malloc=13729KB #67925)
(mmap: reserved=101168KB, committed=63364KB)
- Compiler (reserved=461KB, committed=461KB)
(malloc=330KB #1138)
(arena=131KB #3)
- Internal (reserved=13877KB, committed=13877KB)
(malloc=13845KB #72978)
(mmap: reserved=32KB, committed=32KB)
- Symbol (reserved=28871KB, committed=28871KB)
(malloc=24740KB #275452)
(arena=4131KB #1)
- Native Memory Tracking (reserved=8393KB, committed=8393KB)
(malloc=45KB #523)
(tracking overhead=8348KB)
- Arena Chunk (reserved=184KB, committed=184KB)
(malloc=184KB)
有关详细信息,请参阅 https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr007.html
For more information see https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr007.html
这篇关于Java本机内存使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!