What are the differences?
Before we move forward, we need to know heap and stack.
Simply saying, heap space contains 1 Eden space , 2 young generations and 1 old generation; stack space is the permanent generation.
Here is one great article about <Understanding Java Garbage Collection>.
Take "ResourceManager" process for example:
[root@admin ~]# jps 2304 ResourceManager
1. ps and pmap can show total reserved memory from OS.
[root@admin ~]# ps auwx|egrep "MEM|2304"|grep -v grep
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
yarn 2304 0.8 2.3 826132 192484 ? Sl 08:54 4:02 /usr/java/jdk1.7.0_45-cloudera/bin/java -Dproc_resourcemanager
[root@admin ~]# pmap -x 2304
2304: /usr/java/jdk1.7.0_45-cloudera/bin/java -Dproc_resourcemanager
Address Kbytes RSS Dirty Mode Mapping
0000000000400000 4 4 0 r-x-- java
0000000000600000 4 4 4 rw--- java
(......)
---------------- ------ ------ ------
total kB 826132 192404 172608
"ps auwx|grep <pid>" shows totally 800MB+ virtual memory(including 190MB physical memory) are reserved. "pmap -x <pid>" shows the same.
Because reserved memory includes shared memory also, it is hard for you to know how much heap memory are used and allocated.
2. jmap and jstat can show used space of heap&stack.
[root@admin ~]#jmap -heap 2304|egrep ":|used =" Attaching to process ID 2304, please wait... Debugger attached successfully. Server compiler detected. JVM version is 24.45-b08 Heap Configuration: Heap Usage: New Generation (Eden + 1 Survivor Space): used = 44627176 (42.559791564941406MB) Eden Space: used = 44264776 (42.21417999267578MB) From Space: used = 362400 (0.345611572265625MB) To Space: used = 0 (0.0MB) concurrent mark-sweep generation: used = 8410104 (8.020500183105469MB) Perm Generation: used = 32389728 (30.889251708984375MB)
[root@admin ~]# jstat -gc 2304 S0C S1C S0U S1U EC EU OC OU PC PU YGC YGCT FGC FGCT GCT 8064.0 8064.0 353.9 0.0 65088.0 43227.3 163520.0 8213.0 31808.0 31630.6 32 0.254 0 0.000 0.254To understand "jstat" output, please check article <Monitor Java Garbage Collection using jstat> firstly.
Here we can see the mapping relationship between outputs from jmap and jstat.
New Generation(used memory) = S0U+S1U+EU
concurrent mark-sweep generation(used memory) = OU
Perm Generation(used memory)=PU.
So the total used heap+stack memory size matches between "jmap" and "jstat":
>>> (44627176+8410104+32389728)/1024.0/1024.0 81.46954345703125 >>> (353.9+0.0+43227.3+8213.0+31630.6)/1024.0 81.469531250000003
3. jmap -histo can show top heap memory objects
This is helpful to troubleshoot heap memory leaking.[root@admin ~]# jmap -histo -F 2304 |more
Attaching to process ID 2304, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.45-b08
Iterating over heap. This may take a while...
Object Histogram:
num #instances #bytes Class description
--------------------------------------------------------------------------
1: 59262 7949504 * ConstMethodKlass
2: 59262 7595200 * MethodKlass
(......)
2721: 1 16 com.sun.research.ws.wadl.Doc$JaxbAccessorF_title
Total : 440785 44864280
thanks a lot for the post !
ReplyDeleteThanks!
ReplyDeleteWhy "ps" shows 800M+ and jstat/jmap only 80M? Was it measured for different processes?
800M+ is for virtual memory, RSS is for physical memory, jmap only dumps heap memory which could be smaller than physical memory usage for that process.
DeleteHow to check
ReplyDeleteruntime usage memory in heap
Thus, if one keeps the few above stated key points in mind, he or she for sure is going to hire one of the best web portal development companies available.. web portal implementation A team of tech experts must be working round-the-clock to ensure the web portal is in fine shape.
ReplyDeletehttps://bayanlarsitesi.com/
ReplyDeleteAltınşehir
Karaköy
Alemdağ
Gürpınar
DPTKZF
Gümüşçay
ReplyDeletePaşaköy
Saraykent
Çarşı
Demirtaş
U7Y4V
Bursa
ReplyDeleteMersin
izmir
Rize
Antep
MZ2R
ankara parça eşya taşıma
ReplyDeletetakipçi satın al
antalya rent a car
antalya rent a car
ankara parça eşya taşıma
EOR4
yalova evden eve nakliyat
ReplyDeletetunceli evden eve nakliyat
giresun evden eve nakliyat
ağrı evden eve nakliyat
van evden eve nakliyat
2İ2S
urfa evden eve nakliyat
ReplyDeletemalatya evden eve nakliyat
burdur evden eve nakliyat
kırıkkale evden eve nakliyat
kars evden eve nakliyat
KPH887
CF801
ReplyDeleteAmasya Lojistik
Rize Parça Eşya Taşıma
Balıkesir Evden Eve Nakliyat
Ardahan Evden Eve Nakliyat
Konya Parça Eşya Taşıma
3ED33
ReplyDeleteAntep Lojistik
Ordu Lojistik
Osmaniye Lojistik
Kütahya Lojistik
Iğdır Evden Eve Nakliyat
D8AFD
ReplyDeleteÇerkezköy Ekspertiz
Bilecik Evden Eve Nakliyat
Bitci Güvenilir mi
Isparta Şehirler Arası Nakliyat
Tunceli Şehir İçi Nakliyat
Etlik Fayans Ustası
Niğde Şehirler Arası Nakliyat
Tekirdağ Lojistik
Ünye Oto Elektrik
BE4EA
ReplyDeleteÇerkezköy Motor Ustası
Aksaray Şehir İçi Nakliyat
Şırnak Parça Eşya Taşıma
Kilis Şehirler Arası Nakliyat
Bitget Güvenilir mi
Muğla Lojistik
Karabük Evden Eve Nakliyat
Gümüşhane Evden Eve Nakliyat
Malatya Şehir İçi Nakliyat
85764
ReplyDeleteYenimahalle Fayans Ustası
Probit Güvenilir mi
İzmir Evden Eve Nakliyat
Ankara Parke Ustası
Referans Kimliği Nedir
Çerkezköy Marangoz
Ünye Asma Tavan
Çerkezköy Kurtarıcı
Ünye Kurtarıcı
B717E
ReplyDeleteCoin Üretme Siteleri
Binance Nasıl Oynanır
Kripto Para Nasıl Üretilir
Bitcoin Üretme
Bitcoin Nasıl Çıkarılır
Coin Kazanma Siteleri
Binance Nasıl Kayıt Olunur
resimli magnet
Coin Çıkarma
27CA0
ReplyDeletebinance referans kodu
binance referans kodu
referans kimliği nedir
resimli magnet
referans kimliği nedir
D9B0F
ReplyDeletedüzce en iyi sesli sohbet uygulamaları
erzincan canlı görüntülü sohbet odaları
samsun bedava sohbet chat odaları
aydın bedava görüntülü sohbet sitesi
bilecik canlı sohbet et
rize ücretsiz sohbet odaları
aksaray görüntülü sohbet odaları
görüntülü sohbet siteleri
tunceli canli sohbet bedava
03949
ReplyDeleteAksaray Ücretsiz Sohbet Siteleri
Ardahan Görüntülü Sohbet Odaları
uşak rastgele sohbet
tekirdağ telefonda görüntülü sohbet
çankırı canlı sohbet sitesi
burdur canlı sohbet et
karaman kızlarla rastgele sohbet
en iyi görüntülü sohbet uygulamaları
bingöl canlı sohbet sitesi
CE453
ReplyDeletebitmex
btcturk
probit
kucoin
kucoin
kripto para haram mı
canlı sohbet
binance referans kimliği
paribu
A4B20
ReplyDeletemercatox
türk kripto telegram grupları
kraken
paribu
kraken
probit
bybit
en iyi kripto para uygulaması
gate io
76C7E
ReplyDeletebitexen
gate io
bitexen
huobi
copy trade nedir
coin nasıl alınır
bitget
en az komisyon alan kripto borsası
mexc
3689E
ReplyDeletegörüntülü güvenilir şov
You’ve captured the essence of the subject beautifully. It’s well-written and engaging. Amazing work!
ReplyDeletequickest way to sell a house Atlantic Beach FL
Very informative article. Thanks for providing such important and necessary information. Appreciate the work you're doing.
ReplyDeletechip guidelines
Wonderful information! Thanks so much for sharing such valuable content with us. Your blog always provides the best and most interesting insights on important topics.
ReplyDeletepopular kid book series about investing