0

In this example:

public class Testbed {

private static final int SIZE = 64;

public static void main(String[] args) throws Exception {
    int limit = 10000;
    run(limit);
}

private static void run(int limit) {
    if (limit == 0) {
        return;
    }
    for (int i = 0; i < 1000; i++) {
        Object ints = new Object[SIZE];
        run(limit - 1);
    }
}
}

When running with -verbose:gc, why is it that SIZE=64 yields no GC whatsoever (i.e. the array is allocated on the stack), but SIZE=65 - does?

JVM is 7u79-2.5.5-0ubuntu1

1 Answers1

0

Nevermind, found an answer here: Declaring multiple arrays with 64 elements 1000 times faster than declaring array of 65 elements

In short, there's a tweakable limit somewhere.

Community
  • 1
  • 1