System News
   
News about Solaris and Sun Microsystems

Free 4 Week Trial!


December 26, 2006
Article #17426
Volume 106, Issue 4
Section: Java Technology

 

a standard native API that allows for native libraries to capture events and control a Java Virtual Machine
 


 


The JVM Tool Interface (JVM TI): How VM Agents Work
Tech Tip

A December tech tip article explains some basics of writing a JavaTM Virtual Machine (JVMTM) tool interface (JVM TI) agent library by walking through the heapTracker demo agent available in the JDK downloads. Senior staff engineer Kelly O-Hair and writer Janice Heiss provide code samples as well in "The JVM Tool Interface (JVM TI): How VM Agents Work".

Tips include being cautious about how much memory to allocate. Too much will cause the VM process to fail. Also, make sure the process can locate the library.

A DVM agent is not needed because the JDK 6 release includes "virtually all the required built-in DTrace probes", according to the authors.

A code sample (abbreviated) shows what agent initialization looks like.

Also in the tech tip are:

  • Event Callbacks, code for cbClassFileLoadHook

  • How to set up the Tracker class for the VM start event

  • The importance of knowing what the stack trace is and to tag the object with a reference to that information

  • Make sure all the event callbacks are completed

See the full article in SDN.

(Please note the terms "Java Virtual Machine" and "JVM" mean a Virtual Machine for the Java platform.) [...read more...]

Keywords:
Other articles in the Java Technology section of Volume 106, Issue 4:

See all archived articles in the Java Technology section.


From the latest issue:



 


Customized news reports about Sun Microsystems. Just the news you need, none of what you don't.
50,000+ Members. 20,000+ Articles Published since 1998.