跑步时
java -javaagent:ObjectSizeFetcherAgent.jar PersistentTime
我明白了
24
这个什么时候ObjectSizeFetcherAgent做
public class ObjectSizeFetcher {
    private static Instrumentation  instrumentation;
    public static void premain(String args, Instrumentation inst) {
        instrumentation = inst;
    }
    public static long getObjectSize(Object o) {
        return instrumentation.getObjectSize(o);
    }
}
当PersistentTime看起来如下
public class PersistentTime {
    List<String>    list    = new ArrayList<String>();
    public static void main(String[] args) {
        PersistentTime p = new PersistentTime();
        p.list.add("a");  // The number is the same with or without this
        p.list.add("b");  // The number is the same with or without this
        p.list.add("c");  // The number is the same with or without this
        System.out.println(ObjectSizeFetcher.getObjectSize(p));
    }
}
为什么向列表中添加元素没有影响?