Search |
||
Playing with the Tiger: Measuring the size of your objectsPosted by mister__m on February 5, 2004 at 7:14 PM PST
As I said, I'm back with more on the new JDK 1.5. There is a new package called
import java.lang.instrument.*;
import java.util.*;
public class InstrumentationTest {
private static Instrumentation inst;
public static void premain(String options, Instrumentation inst) {
InstrumentationTest.inst = inst;
System.out.println("options= " + options);
// Get all classes currently loaded by VM
Class[] loaded = inst.getAllLoadedClasses();
// Sort them by name
Arrays.sort(loaded, new Comparator
Save it as javac -source 1.5 InstrumentationTest.java To allow our class to be useful, we have to start the VM using this verbose command: java -ea -javaagent:InstrumentationTest -cp . InstrumentationTest Someone might be asking how it could be useful. As a friend of mine, Bruno Borges, suggested to me, it could give you a good idea if Prevayler is the right tool for your needs. Hope you've enjoyed it. More to come! »
Related Topics >>
J2SE Comments
Comments are listed in date ascending order (oldest first)
|
||
|
|