Could not reserve enough space for object heap

后端 未结 26 1832
余生分开走
余生分开走 2020-11-22 05:59

I am getting the following exception repeatedly each time I try to run the program.

Error occurred during initialization of VM

Could not reserve e

26条回答
  •  时光说笑
    2020-11-22 06:48

    Sometimes, this error indicates that physical memory and swap on the server actually are fully utilized!

    I was seeing this problem recently on a server running RedHat Enterprise Linux 5.7 with 48 GB of RAM. I found that even just running

    java -version
    

    caused the same error, which established that the problem was not specific to my application.

    Running

    cat /proc/meminfo
    

    reported that MemFree and SwapFree were both well under 1% of the MemTotal and SwapTotal values, respectively:

    MemTotal:     49300620 kB
    MemFree:        146376 kB
    ...
    SwapTotal:     4192956 kB
    SwapFree:         1364 kB
    

    Stopping a few other running applications on the machine brought the free memory figures up somewhat:

    MemTotal:     49300620 kB
    MemFree:       2908664 kB
    ...
    SwapTotal:     4192956 kB
    SwapFree:      1016052 kB
    

    At this point, a new instance of Java would start up okay, and I was able to run my application.

    (Obviously, for me, this was just a temporary solution; I still have an outstanding task to do a more thorough examination of the processes running on that machine to see if there's something that can be done to reduce the nominal memory utilization levels, without having to resort to stopping applications.)

提交回复
热议问题