corretto / heapothesys

Heapothesys /hɪˈpɒθɪsɪs/ is a heap allocation JVM benchmark developed by the Amazon Corretto team.
Apache License 2.0
172 stars 36 forks source link

HyperAlloc: java.lang.NegativeArraySizeException with low values of -n #74

Open tstuefe opened 3 months ago

tstuefe commented 3 months ago

Setting -n to a value below 40 (e..g 32) give me

java.util.concurrent.ExecutionException: java.lang.NegativeArraySizeException: -5
        at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
        at com.amazon.corretto.benchmark.hyperalloc.SimpleRunner.start(SimpleRunner.java:65)
        at com.amazon.corretto.benchmark.hyperalloc.HyperAlloc.main(HyperAlloc.java:13)
Caused by: java.lang.NegativeArraySizeException: -5
        at com.amazon.corretto.benchmark.hyperalloc.AllocObject.<init>(AllocObject.java:31)
        at com.amazon.corretto.benchmark.hyperalloc.AllocObject.create(AllocObject.java:100)
        at com.amazon.corretto.benchmark.hyperalloc.AllocObject.create(AllocObject.java:87)
        at com.amazon.corretto.benchmark.hyperalloc.TaskBase.lambda$createSingle$0(TaskBase.java:90)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1575)

-n 40 gives me

Exception in thread "HyperAlloc-Store" java.lang.IllegalArgumentException: bound must be positive
        at java.base/java.util.Random.nextInt(Random.java:551)
        at java.base/java.util.concurrent.ThreadLocalRandom.nextInt(ThreadLocalRandom.java:453)
        at com.amazon.corretto.benchmark.hyperalloc.AllocObject.touch(AllocObject.java:57)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)
        at com.amazon.corretto.benchmark.hyperalloc.ObjectStore.reshuffle(ObjectStore.java:212)
        at com.amazon.corretto.benchmark.hyperalloc.ObjectStore.run(ObjectStore.java:126)
        at java.base/java.lang.Thread.run(Thread.java:1575)
tstuefe commented 3 months ago

Setting -n to a value below 40 (e..g 32) give me

java.util.concurrent.ExecutionException: java.lang.NegativeArraySizeException: -5
        at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
        at com.amazon.corretto.benchmark.hyperalloc.SimpleRunner.start(SimpleRunner.java:65)
        at com.amazon.corretto.benchmark.hyperalloc.HyperAlloc.main(HyperAlloc.java:13)
Caused by: java.lang.NegativeArraySizeException: -5
        at com.amazon.corretto.benchmark.hyperalloc.AllocObject.<init>(AllocObject.java:31)
        at com.amazon.corretto.benchmark.hyperalloc.AllocObject.create(AllocObject.java:100)
        at com.amazon.corretto.benchmark.hyperalloc.AllocObject.create(AllocObject.java:87)
        at com.amazon.corretto.benchmark.hyperalloc.TaskBase.lambda$createSingle$0(TaskBase.java:90)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1575)

-n 40 gives me

Exception in thread "HyperAlloc-Store" java.lang.IllegalArgumentException: bound must be positive
        at java.base/java.util.Random.nextInt(Random.java:551)
        at java.base/java.util.concurrent.ThreadLocalRandom.nextInt(ThreadLocalRandom.java:453)
        at com.amazon.corretto.benchmark.hyperalloc.AllocObject.touch(AllocObject.java:57)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)
        at com.amazon.corretto.benchmark.hyperalloc.ObjectStore.reshuffle(ObjectStore.java:212)
        at com.amazon.corretto.benchmark.hyperalloc.ObjectStore.run(ObjectStore.java:126)
        at java.base/java.lang.Thread.run(Thread.java:1575)

Anything >= 48 seems to work.