How to profile object creation in Java?

The system I work with creates a lot of objects and garbage that collect them all the time, which leads to a very cool-jagged heap consumption schedule. I would like to know what objects are created to set up the code, but I cannot figure out how to dump the heap at the time the garbage collection starts. When I tried to initiate dumpHeap via JConsole manually at arbitrary points in time, I always got results after the GC finished its launch and did not receive any useful data.

Any notes on how to track excessive creation of temporary objects are welcome.

+3
source share
4 answers

, BTrace (http://kenai.com/projects/btrace/pages/Home), jvisualvm JDK 6u18, .

+1

, , - . , : Allocation Instrumentor for Java. :

dumpHeap JConsole , GC , .

, , - , ( ) - , , , GC .

Java - - , .

+1

Apache JMeter

:

Apache JMeter , (, , Perl , Java, , FTP- ..). , , .

I remember that M. Fowler mentioned that it is almost impossible to guess what causes performance problems until you check the entire system with the profiler.

0
source

You can use the JVMPI interface (and tools such as Dr.MEM) and create your own solution, if not the solutions described above solve your goal. This may, however, be excessive, depending on your problem.

0
source

Source: https://habr.com/ru/post/1737204/


All Articles