How do I display java.lang.* object allocations in Eclipse profiler?

Posted by Martin Wickman on Stack Overflow See other posts from Stack Overflow or by Martin Wickman
Published on 2010-06-07T13:38:15Z Indexed on 2010/06/07 13:42 UTC
Read the original article Hit count: 237

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about eclipse