690 shaares
3 liens privés
3 liens privés
2 résultats
taggé
native
Dumping des informations mémoires.
Une JVM configuré pour 7Go en prend 13G en mémoire.
Ajout du flag :
-XX:NativeMemoryTracking=summary
Attention impact un peu les performances.
Résultat, la différence était dans "Symbol" : Here is the NMT report about the symbol allocations, such as the string table and constant pool.
Et en effet cette JVM manipule beaucoup de chaines qu'elle garde en mémoire qui pourrait être interned
https://stackoverflow.com/questions/10578984/what-is-java-string-interning
http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#intern()
Basically doing String.intern() on a series of strings will ensure that all strings having same contents share same memory. So if you have list of names where 'john' appears 1000 times, by interning you ensure only one 'john' is actually allocated memory.
Heap dump pour la suite.
-XX:NativeMemoryTracking=summary
which produces an overview of the memory usage by the components of the JVM. It actually gives a pretty good picture of the "cost" of having a JVM.
Enabling detailed native memory tracking (NMT) causes a 5% to 10% performance overhead. The summary mode merely has an impact in memory usage as shown below and is usually enough.
It is necessary to note that while the above command indicate a scale in KB for the JVM it really means KiB.
JVM native memory tracking report
$ jcmd $(pidof java) VM.native_memory
Example of output :
Native Memory Tracking:
Total: reserved=7168324KB, committed=5380868KB
- Java Heap (reserved=4456448KB, committed=4456448KB)
(mmap: reserved=4456448KB, committed=4456448KB)
- Class (reserved=1195628KB, committed=165788KB)
(classes #28431)
( instance classes #26792, array classes #1639)
(malloc=5740KB #87822)
(mmap: reserved=1189888KB, committed=160048KB)
( Metadata: )
( reserved=141312KB, committed=139876KB)
( used=135945KB)
( free=3931KB)
( waste=0KB =0.00%)
( Class space:)
( reserved=1048576KB, committed=20172KB)
( used=17864KB)
....