insufficient memory for the Java Runtime Environment to continue though RAM is showing 6 GB free space

后端 未结 4 1795
挽巷
挽巷 2021-02-14 06:44

While running java application I\'m getting the following memory dump.

After installing java 8(with java 7 application was working before) I started getting the below er

4条回答
  •  渐次进展
    2021-02-14 07:37

    I was getting the similar memory dumps while running the same java application on Windows 10 and 8.1(both 64 bit).

    Windows 8.1

    32GB RAM

    i7-4790 3.60GHz CPU

    Paging file size(fixed, 14GB)

    Windows 10

    16GB RAM

    i7-4790 3.60GHz CPU

    Paging file size(automatically managed, initially was fixed, 14GB)

    1st issue was that with identical hardware(the difference in RAM only and OS), application on Windwos 10 was crashing almost instantly. The most surprising thing, that in Task manager I saw that only 25% of RAM is used.

    After searching info in google, I've found that:

    1. I need to set automatically managed paging file for Windows 10.
    2. Windows 10 is more greedy with committed memory than previous versions of windows.

    2nd issue

    As was mentioned by @borjab

    Java, by default, does not uses all available memory.

    To get a help on non-standard options for Java type in your CMD:

    java -X
    

    Output:

    -Xms        set initial Java heap size
    -Xmx        set maximum Java heap size
    

    can be defined in

    G - Gigabytes  
    M - Megabytes  
    K - Kilobytes
    

    The final solution for both OS was:

    java -Xmx15G -Xms15G -jar selenium-server-standalone-3.4.0.jar
    

    My initial java version

    java version "1.8.0_91"

    Java(TM) SE Runtime Environment (build 1.8.0_91-b14)

    Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

    Updated java version

    java version "1.8.0_152"

    Java(TM) SE Runtime Environment (build 1.8.0_152-b16)

    Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)

提交回复
热议问题