Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

private bytes increase for a javaw process in java 8

My project has started using java 8 from java 7.

After switching to java 8, we are seeing issues like the memory consumed is getting higher with time.

Here are the investigations that we have done :

  • Issues comes only after migrating from java7 and from java8
  • As metaspace is the only thing related to memory which is changes from hava 7 to java 8. We monitored metaspace and this does not grow more then 20 MB.
  • Heap also remains consistent.

Now the only path left is to analyze how the memory gets distributes to process in java 7 and java 8, specifically private byte memory. Any thoughts or links here would be appreciated.

NOTE: this javaw application is a swing based application.

UPDATE 1 : After analyzing the native memory with NMT tool and generated a diff of memory occupied as compare to baseline. We found that the heap remained same but threads are leaking all this memory. So as no change in Heap, I am assuming that this leak is because of native code.

So challenge remains still open. Any thoughts on how to analyze the memory occupied by all the threads will be helpful here. Below are the snapshots taken from native memory tracking.

In this pic, you can see that 88 MB got increased in threads. Where arena and resource handle count had increased a lot.

enter image description here

in this picture you can see that 73 MB had increased in this Malloc. But no method name is shown here. enter image description here

So please throw some info in understanding these 2 screenshot.

like image 443
Onki Avatar asked Sep 19 '15 09:09

Onki


1 Answers

You may try another GC implementation like G1 introduced in Java 7 and probably the default GC in Java 9. To do so just launch your Java apps with:

-XX:+UseG1GC

There's also an interesting functionality with G1 GC in Java 8u20 that can look for duplicated Strings in the heap and "deduplicate" them (this only works if you activate G1, not with the default Java 8's GC).

-XX:+UseStringDeduplication

Be aware to test thoroughly your system before going to production with such a change!!!

Here you can find a nice description of the diferent GCs you can use

like image 193
Sergio Avatar answered Sep 19 '22 22:09

Sergio