From your image, it looks like the instances of MyClass
you created aren't even live when you're doing the profiling. The char[]
usage is expected since char arrays back String
s, which are used extensively in class definitions, etc.
It could be that your array is getting garbage collected since it's not used. Try adding a line after the sleep that uses the array, and then try to profile again. Example:
MyClass[][] objects = new MyClass[4096][4096];
for(int i = 0;i<4096;i++)
{
for(int j = 0;j<4096;j++)
{
objects[i][j] = new MyClass();
}
}
Thread.sleep(1000000);
System.out.println(objects[10][40]);
This ensures that the array is not eligible for garbage collection until you've had a chance to profile it.