代码之家  ›  专栏  ›  技术社区  ›  prat22

如何在windows中增加JVM运行时内存

  •  4
  • prat22  · 技术社区  · 7 年前

    我正在尝试通过命令行运行脚本,因为我正在使用下面的命令

     C:\apache-jmeter-4.0\apache-jmeter-4.0\bin>jmeter -f -n -t C:\apache-jmeter-4.0\apache-jmeter-4.0\bin\examples\Post_call_24_FirstStep_10.jmx -l C:\apache-jmeter-4.0\apache-jmeter-4.0\bin\examples\CSVDATATest.csv  
    

    但它给出了以下错误

    Java HotSpot(TM) Client VM warning: INFO: os::commit_memory(0x05400000, 1073741824, 0) failed; error='The paging file is too small for this operation to complet e' (DOS error/errno=1455)
    #
    # There is insufficient memory for the Java Runtime Environment to continue.
    # Native memory allocation (mmap) failed to map 1073741824 bytes for Failed 
    to commit area from 0x05400000 to 0x45400000 of length 1073741824.
    # An error report file with more information is saved as:
    # C:\apache-jmeter-4.0\apache-jmeter-4.0\bin\hs_err_pid2076.log
     errorlevel=1 Press any key to continue . . .
    
    2 回复  |  直到 7 年前
        1
  •  5
  •   Dmitri T    7 年前

    根据您得到的错误:

    分页文件太小,无法完成此操作

    您需要增加虚拟内存(交换文件)的大小,请参阅 How to Change The Size of Virtual Memory (pagefile.sys) on Windows 8 or Windows Server 2012 更多详细信息指南。


    但是,请注意,使用swap将对JMeter的性能产生巨大的负面影响,因此,如果可用的物理RAM不足,最好考虑 Distributed Testing -即,在多台主机上运行JMeter从机,因为您很可能无法从一台计算机创建所需的负载。

    参考文献:

        2
  •  2
  •   Mike Doe Backs    7 年前

    您可以分配 80% 您需要在JMeter的下面一行输入内存。bat文件

    Set HEAP=-Xms1024m –Xmx3072m [If you have 4 GB Ram]
    

    您可以根据机器的物理内存调整以上堆大小。