test/jdk/java/lang/ThreadLocal/MemoryLeak.java introduced in https://bugs.openjdk.org/browse/JDK-4414045 loops 1.1 million times. When it was created, it was probably correct, but with modern heap sizes my thinking is that there will never be a shortage of memory and if we would leak, we would not notice it as we have enough heap size to leak far more than 1.1 million objects. I think the test ought to be started with a limited heap size, and maybe more iterations
Maybe something like:
```
/*
* @test
* @bug 4414045
* @summary Tests to see that memory leak no longer exists.
* @run main/othervm -Xmx60m MemoryLeak
*/
public class MemoryLeak {
public static void main(String[] args) {
for (int i = 0; i < 30_000_000; i++) {
ThreadLocal t = new ThreadLocal();
t.set(new Object());
t.set(null);
}
}
}
```
Maybe something like:
```
/*
* @test
* @bug 4414045
* @summary Tests to see that memory leak no longer exists.
* @run main/othervm -Xmx60m MemoryLeak
*/
public class MemoryLeak {
public static void main(String[] args) {
for (int i = 0; i < 30_000_000; i++) {
ThreadLocal t = new ThreadLocal();
t.set(new Object());
t.set(null);
}
}
}
```