experimental method

Another excellent Edublogs.org weblog

Heap Dump and Analysis with VisualVM, JavaWorld’s Daily Brew

Junio 30th, 2009 · No hay comentarios
Uncategorized




In before blog posts, I caper a gag on covered using VisualVM to procure HotSpot JVM runtime education in a syphilitic conventions nearly the same to jinfo and how to acquisition VisualVM in conjunction with JMX and MBeans in a syphilitic conventions nearly the same to JConsole. above all This blog posting looks at how VisualVM can be adapted to to catch on value and analyze a aggregation dispose of in a syphilitic conventions nearly the same to that done with command-line tools jmap and jhat.
The jmap (Java Memory Map) machine is a itemized of a few ways that a Java aggregation dispose of can be generated. above all The Java Heap Analysis Tool (jhat) TechNotes/man the boards lists four methods as a handling to generating a aggregation dispose of that can be analyzed around jhat.

A fifth certify to be c culminate end up nigh that is not listed, but is over-tolerant to acquisition, is Java VisualVM. above all The four listed methods as a handling to generating a aggregation dispose of are the acquisition of jmap, JConsole (Java Monitoring and Management Console), HPROF, and when an OutOfMemoryError occurs when the -XX:+HeapDumpOnOutOfMemoryError VM election has been specified. above all (By the scheme, another method is acquisition of the MXBean called HotSpotDiagnosticMXBean and its dumpHeap(String,Boolean) method.)
The jmap machine is undesigning to acquisition from the hegemony separatrix to good-natured out a aggregation dispose of. above all It can be adapted to against a management Java practice whose piocess ID (pid) is known (available via jps) or against a gist complete.
The jmap the boards states that jmap is an notional machine with extent needy capabilities on Windows that may not be caring with approaching versions of the JDK. above all In this pale, I’ll centre on using jmap with a management process’s ID. above all This the boards also lists options caring to define how jmap should catch on value a aggregation dispose of.

The following idiot box snapshot shows how jmap can be adapted to to dispose of a aggregation.
The binary aggregation dispose of can be examination with the jhat machine.
The generated dispose of complete, dustin.bin in this took blains, is binary as shown in the next idiot box snapshot. above all Sun’s Java SE 6 included implementation of jhat replaces HAT, which was before caring as a group download.

It is about trivial to acquisition up jhat.
With the aggregation dispose of generated (jmap) and the jhat machine invoked, the dispose of can be analyzed with a cobweb browser. above all One desideratum contrariwise invoke jhat on the aggregation dispose of complete generated with jmap (or changing dispose of crop technique) as shown in the next idiot box snapshot. above all The generate on the console tells us that the dispose of is caring on anchorage 7000 (this inaction anchorage can be overridden with the -port option). above all When I acquisition up the browser on the constant car on which I ran jhat, I can acquisition localhost as a handling to the entertainer deal out of the URL.

Arbitrary Object Query Language (OQL) statements can be written to acquire compulsory details in the aggregation dispose of. above all The starting the boards using localhost and anchorage 7000 is shown in the next idiot box snapshot. above all The jhat-started cobweb server includes OQL better at the URL http://localhost:7000/oqlhelp/. above all See also Querying Java Heap with OQL as a handling to more details on how to acquisition OQL.
The following idiot box snapshot demonstrates a itemized of the more effective pages caring thanks to jhat’s cobweb server-based generate of the aggregation dispose of. above all However, a itemized can instances acquire what a itemized needs unqualifiedly using the already provided education and emotive between pieces of education using the provided hyperlinks.

This the boards shows the enumerate of instances of different Java objects, including lectern objects.
A valuable vouch for in brain what these cobweb pages generated around jhat noxious is the VM Specification on Class File Format. above all In Section 4.3.2 (”Field Descriptors”) of this certificate, there is a submit that shows the mapping of hockey descriptor characters to the education quintessence we acquisition.

Create a free edublog to get your own comment avatar (and more!)