Jmeter | Uncaught Exception java.lang.OutOfMemoryError: unable to create new native thread.

xiaoxiao2021-02-28  19

Jmeter 在做性能测试的时候,控制台打印出下面的日志:

Don't use GUI mode for load testing, only for Test creation and Test debugging ! For load testing, use NON GUI Mode: jmeter -n -t [jmx file] -l [results file] -e -o [Path to output folder] & adapt Java Heap to your test requirements: Modify HEAP="-Xms512m -Xmx512m" in the JMeter batch file ================================================================================ Uncaught Exception java.lang.OutOfMemoryError: unable to create new native thread. See log file for details.

内存溢出, 下面方法来解决:

in the Jmeter 3.x. there are two steps to solve this problem.

Step 1, to modify the JVM memory in the JMeter batch file

## ============================================== ## Environment variables: ## JVM_ARGS - optional java args, e.g. -Dprop=val ## ## e.g. ## JVM_ARGS="-Xms512m -Xmx512m" jmeter etc. ## ## ==============================================

this is a default value in the jmeter.sh, according to your environment:

JVM_ARGS="-Xms512m -Xmx2048m"

in the jmeter.bat:

set JVM_ARGS=-Xms512m -Xmx2048m

Step 2, to Modify HEAP=”-Xms512m -Xmx512m” in the JMeter batch file:

in the jmeter.sh

HEAP="-Xms512m -Xmx2048m"

in the jmeter.bat:

set HEAP=-Xms512m -Xmx2048m

参照我在stackoverflow上的回答:https://stackoverflow.com/questions/20647651/jmeter-test-failed-with-out-of-memory-error/47990042#47990042

转载请注明原文地址: https://www.6miu.com/read-450012.html

最新回复(0)