maslan maslan - 23 days ago 11x
Java Question

JMH add memory using Options builder

I am running a JMH benchmark:

Options opt = new OptionsBuilder()
.output("C:/test/infinispan/benchmarkThr" + THREAD_COUNT + ".txt")
//.jvmArgsPrepend("-Xms1024m -Xmx1024m")

new Runner(opt).run();

I get OutOfMemoryError. I wanted to add more (the commented out text) but I iget an error that seems strange to me (this should IMO work):

# Run progress: 0,00% complete, ETA 00:16:40
# Fork: 1 of 1
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Invalid initial heap size: -Xms1024M -Xmx1124M

How to succesfully add the memory?


Provide each argument separately using 2 String instead of one as next:

.jvmArgs("-Xms1024m", "-Xmx1024m")