A new article on java.sun.com, Sun's main Java site, by Sun developer Kelly O'Hair, titled "The JVM Tool Interface (JVM TI): How VM Agents Work," (http://java.sun.com/developer/technicalArticles/J2SE/jvm_ti
/) focuses on VM agents, which are good for assessing what's going on in a JVM. The JVM tool interface (JVM TI) is a standard native API that allows native libraries to capture events and control a Java Virtual Machine (JVM) for the Java platform. These native, or "agent" libraries often form a basis for the Java technology-level tool APIs, such as the Java Debugger Interface (JDI) that comes with the Java Development Kit (JDK). Profiler tool vendors will often need to create an agent library that uses JVM TI. The article explores the basics of writing a JVM TI agent library by walking through the heapTracker demo agent available in the JDK downloads.
I have a question or two for anyone experienced with VM agents: What are the main pitfalls involved in adding an agent library? Are memory leaks as big a problem as O'Hair and others suggest? O'Hair says, "In general, experimentation and time are required to produce a good solution and/or a good, robust agent." Does anyone have advice or rules or principles to share about how to proceed in entering these waters?