public class Test {

  public static void main(String[] args) {
    while (true) {
      byte[] array = new byte[4 * 1024];
    }
  }

}

public class Test {

  public static void main(String[] args) {
    for (int i = 0; i < 1024; ++i) {
      byte[] a = new byte[4 * 1024];
    }

    for (int i = 0; i < 1024; ++i) {
      Object[] array = new Object[32];
      for (int j = 0; j < 32; ++j) {
        array[j] = new byte[32 * 1024];
      }
    }
  }

}

update Test.java to work the GC harder