springboot运行过程中报 There is insufficient memory for the Java Runtime Environment to continue.
错误如下:
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 746586112 bytes for G1 virtual space
# Possible reasons:
# The system is out of physical RAM or swap space
# The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with -XX:ReservedCodeCacheSize=
# JVM is running with Zero Based Compressed Oops mode in which the Java heap is
# placed in the first 32GB address space. The Java Heap base address is the
# maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress
# to set the Java Heap base and to place the Java Heap above 32GB virtual address.
# This output file may be truncated or incomplete.
#
# Out of Memory Error (os_windows.cpp:3552), pid=119572, tid=46956
#
# JRE version: Java(TM) SE Runtime Environment (17.0.9+11) (build 17.0.9+11-LTS-201)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (17.0.9+11-LTS-201, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
在添加设置 -Xms2048m -Xmx3027m 扔无法解决问题时,考虑 The system is out of physical RAM or swap space
系统可能超出物理内存或交换空间,首先物理内存肯定没有超出,那么肯定就是交换空间超出了。什么是交换空间呢?交换空间,在Windows系统中是指虚拟内存。调整交换空间大小即设置虚拟内存大小。这样就清晰了,就是电脑的虚拟内存设的不够,于是点开我的电脑->属性->高级系统设置->高级->设置->高级里,看到虚拟内存设置是否够用
可以通过自定义设置虚拟内存大小来解决问题