Reputation: 14075
I have a very performance sensitive application in Java. (I know I should actually use C or something else. But it's Java now.) I'm trying to avoid creating and throwing away objects. Now I need to know how much garbage collecting is going on still.
How can I find out ?
If possible I would like to have a sort of number in milliseconds or nanoseconds something that doesn't require installation of more software.
Upvotes: 11
Views: 16193
Reputation: 66637
You can use tools like VisualVM to monitor application activity. Make sure you are using appropriate GC alogorithms.
Oracle JVM provides multiple types of Garbage Collectors:
Read more on these collectors here.
Upvotes: 8
Reputation: 649
Or you can let JVM print the GC activity.. These settings I have:
-verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -XX:+PrintTenuringDistribution -Xloggc:logs/gc.log
GC activity is printed to a file logs/gc.log..
Upvotes: 9
Reputation: 121998
Jprofiler ,which Enables both memory profile to assess memory usage and dynamic allocation leaks and CPU profiling to assess thread conflicts.
Upvotes: 1