How do I display java.lang.* object allocations in Eclipse profiler?
- by Martin Wickman
I am profiling an application using the Eclipse profiler. I am particularly interested in number of allocated object instances of classes from java.lang (for instance java.lang.String or java.util.HashMap). I also want to know stuff like number of calls to String.equals() etc.
I use the "Object Allocations" tab and I shows all classes in my application and a count. It also shows all int[], byte[], long[] etc, but there is no mention of any standard java classes.
For instance, this silly code:
public static void main(String[] args)
{
Object obj[] = new Object[1000];
for (int i = 0; i < 1000; i++) {
obj[i] = new StringBuffer("foo" + i);
}
System.out.println (obj[30]);
}
Shows up in the Object Allocations tab as 7 byte[]s, 4 char[]s and 2 int[]s. It doesn't matter if I use 1000 or 1 iterations. It seems the profiler simply ignores everything that is in any of the java.* packages. The same applies to Execution Statistics as well.
Any idea how to display instances of java.* in the Eclipse Profiler?