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

后端 未结 4 1790
挽巷
挽巷 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:27

    Java, by default, does not uses all avalaible memory. You need to run the application with the corresponding parameters.

    See this question to all the details. (It can change with the version of Java).

    The parameter setting can be set on the command line but if you use an application you may have some configuration file. For example, in Eclipse you have eclipse.ini where you an set your memory preferences.

    0 讨论(0)
  • 2021-02-14 07:29

    Some programs use a lot of memory, like Elasticsearch, try to add more memory if you use this kind of memory intensive program

    0 讨论(0)
  • 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<size>        set initial Java heap size
    -Xmx<size>        set maximum Java heap size
    

    <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)

    0 讨论(0)
  • 2021-02-14 07:45

    Your application, by default, does not use all the available system memory (or RAM). The limit depends on the xmx value you have set.

    Not sure if 64 bit is an option for you, if it is, this lets you increase your xmx more than the 32 bit version.

    0 讨论(0)
提交回复
热议问题