Home  >  Article  >  Java heap space - despite heap growth

Java heap space - despite heap growth

WBOY
WBOYforward
2024-02-09 12:40:101089browse

Java heap space is the memory area used to store object instances in the Java virtual machine. It is an important part of the Java program runtime. The size of the heap space can be dynamically adjusted. As the program runs, the heap space can be increased or decreased. Although the size of the heap space can be increased, care should be taken to properly manage the use of heap space to avoid memory overflow. In the management of Java heap space, you need to pay attention to the operation of the garbage collection mechanism and reasonably set the size of the heap space to achieve efficient operation of the program.

Question content

The problem I am facing is that the java heap space exception occurs, but I have just increased the heap space. I have increased the heap space

jmeter.sh

jvm_args="-xms1g -xmx8g"
heap="-xms1g -xmx8g"

and jmeter.bat

set jvm_args=-xms1g -xmx8g
set heap=-xms1g -xmx8g

There is no listner in my test plan, jmeter is started through command line, but nothing, java heap space exception always appears.

Are there any real experts who can help me?

Complete exception:

java.lang.OutOfMemoryError: Java heap space Dumping heap to java_pid32652.hprof ... Heap dump file created [8922760824 bytes in 40.975 secs] summary + 55 in 00:01:03 = 0.9/s Avg: 9671 Min: 0 Max: 89909 Err: 41 (74.55%) Active: 50 Started: 50 Finished: 0 summary = 3811 in 00:03:38 = 17.5/s Avg: 1149 Min: 0 Max: 89909 Err: 41 (1.08%) Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "boundedElastic-94"

Workaround

Maybe I'm not a "real expert" but I can see that the changes in the jmeter.sh file are incorrect. You should use the export command to set environment variables.

You can also get the effective jvm heap size on any jsr223 test element 中使用以下代码>:

println('Current heap: ' + Runtime.getRuntime().maxMemory() / 1024 / 1024 / 1024 + ' GB')

More information: 9 simple solutions for jmeter load test "out of memory" failure

If heap changes are applied and errors are still encountered, the only way to handle this is to switch to Distributed Testing Mode

The above is the detailed content of Java heap space - despite heap growth. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:stackoverflow.com. If there is any infringement, please contact admin@php.cn delete