簡體   English   中英

盡管RAM顯示6 GB可用空間,但Java Runtime Environment的內存不足

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

在運行java應用程序時,我得到以下內存轉儲。

安裝java 8后(java 7應用程序之前正在運行)我開始收到以下錯誤。

我正在使用16 GB RAM,在我檢查時(在應用程序啟動時)任務管理器中,大約6 GB RAM是免費的。

有人可以幫助解決問題嗎?

#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 472736 bytes for Chunk::new
# Possible reasons:
#   The system is out of physical RAM or swap space
#   In 32 bit mode, the process size limit was hit
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Use 64 bit Java on a 64 bit OS
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (allocation.cpp:390), pid=1104, tid=0x00000000000016ec
#
# JRE version: Java(TM) SE Runtime Environment (8.0_92-b14) (build 1.8.0_92-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.92-b14 mixed mode windows-amd64 compressed oops)
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#

---------------  T H R E A D  ---------------

---------------------------------------------------

Java Threads: ( => current thread )
  0x00000000232a8800 JavaThread "AWSessionMonitor Thread" daemon [_thread_blocked, id=14084, stack(0x0000000022b20000,0x0000000022c20000)]
  0x0000000028728800 JavaThread "Thread-3" [_thread_blocked, id=11332, stack(0x00000000210b0000,0x00000000211b0000)]
  0x00000000252a4800 JavaThread "Thread-2" [_thread_blocked, id=5272, stack(0x0000000020fb0000,0x00000000210b0000)]
  0x000000001e874000 JavaThread "SQLStatementMonitor" [_thread_blocked, id=1876, stack(0x0000000022620000,0x0000000022720000)]
  0x000000001de0d800 JavaThread "Thread-1" daemon [_thread_blocked, id=13052, stack(0x0000000022520000,0x0000000022620000)]
  0x000000001f7f8000 JavaThread "Session Timeout Thread" daemon [_thread_blocked, id=11088, stack(0x0000000022220000,0x0000000022320000)]
  0x0000000002c11800 JavaThread "DestroyJavaVM" [_thread_blocked, id=14168, stack(0x0000000002a00000,0x0000000002b00000)]
  0x000000001f32b800 JavaThread "Thread-0" [_thread_in_vm, id=10720, stack(0x0000000020bc0000,0x0000000020cc0000)]
  0x000000001fb3e800 JavaThread "Perf_Log_Traceplan-" daemon [_thread_blocked, id=2992, stack(0x0000000020ac0000,0x0000000020bc0000)]
  0x0000000020319800 JavaThread "Perf_Log_Traceperf-" daemon [_thread_blocked, id=6176, stack(0x00000000209c0000,0x0000000020ac0000)]
  0x000000001da8b000 JavaThread "Service Thread" daemon [_thread_blocked, id=9968, stack(0x000000001e020000,0x000000001e120000)]
  0x000000001da64000 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=12708, stack(0x000000001df20000,0x000000001e020000)]
  0x000000001c13e000 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=10652, stack(0x000000001de20000,0x000000001df20000)]
=>0x000000001c128000 JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=5868, stack(0x000000001d920000,0x000000001da20000)]
  0x000000001c118000 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=12444, stack(0x000000001d820000,0x000000001d920000)]
  0x000000001c10c000 JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_in_native, id=2640, stack(0x000000001d720000,0x000000001d820000)]
  0x000000001c100800 JavaThread "Attach Listener" daemon [_thread_blocked, id=9952, stack(0x000000001d620000,0x000000001d720000)]
  0x000000001c0ff800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=13880, stack(0x000000001d520000,0x000000001d620000)]
  0x000000001c0e6000 JavaThread "Finalizer" daemon [_thread_blocked, id=7868, stack(0x000000001d340000,0x000000001d440000)]
  0x000000001c0bd000 JavaThread "Reference Handler" daemon [_thread_blocked, id=11580, stack(0x000000001d240000,0x000000001d340000)]

Other Threads:
  0x000000001c0b3800 VMThread [stack: 0x000000001d140000,0x000000001d240000] [id=12984]
  0x000000001db42800 WatcherThread [stack: 0x000000001e120000,0x000000001e220000] [id=9136]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap:
 PSYoungGen      total 524800K, used 42318K [0x000000076c580000, 0x000000078cf80000, 0x00000007c0000000)
  eden space 515584K, 8% used [0x000000076c580000,0x000000076eed3b10,0x000000078bd00000)
  from space 9216K, 0% used [0x000000078bd00000,0x000000078bd00000,0x000000078c600000)
  to   space 8704K, 0% used [0x000000078c600000,0x000000078c600000,0x000000078ce80000)
 ParOldGen       total 99328K, used 24647K [0x00000006c5000000, 0x00000006cb100000, 0x000000076c580000)
  object space 99328K, 24% used [0x00000006c5000000,0x00000006c6811d80,0x00000006cb100000)
 Metaspace       used 22833K, capacity 23012K, committed 23344K, reserved 1071104K
  class space    used 2715K, capacity 2786K, committed 2864K, reserved 1048576K

Card table byte_map: [0x00000000120c0000,0x00000000128a0000] byte_map_base: 0x000000000ea98000

Marking Bits: (ParMarkBitMap*) 0x0000000069bf64f0
 Begin Bits: [0x00000000131e0000, 0x00000000170a0000)
 End Bits:   [0x00000000170a0000, 0x000000001af60000)

Polling page: 0x00000000024b0000

CodeCache: size=245760Kb used=11544Kb max_used=11559Kb free=234215Kb
 bounds [0x0000000002d00000, 0x0000000003860000, 0x0000000011d00000]
 total_blobs=2659 nmethods=2233 adapters=346
 compilation: enabled

Compilation events (10 events):
Event: 191.393 Thread 0x000000001da64000 2532       3       org.apache.xerces.util.XMLAttributesImpl::checkDuplicatesNS (278 bytes)
Event: 191.393 Thread 0x000000001c13e000 2535       4       org.apache.xerces.impl.XMLEntityScanner::scanQName (510 bytes)
Event: 191.394 Thread 0x000000001da64000 nmethod 2532 0x0000000003825d10 code [0x0000000003825f60, 0x0000000003826d38]
Event: 191.394 Thread 0x000000001da64000 2530       3       org.apache.xerces.impl.xs.opti.SchemaDOM::emptyElement (23 bytes)
Event: 191.394 Thread 0x000000001da64000 nmethod 2530 0x00000000037d66d0 code [0x00000000037d6840, 0x00000000037d6a98]
Event: 191.394 Thread 0x000000001da64000 2533       3       org.apache.xerces.impl.xs.opti.SchemaDOM::startElement (29 bytes)
Event: 191.395 Thread 0x000000001da64000 nmethod 2533 0x00000000037fb4d0 code [0x00000000037fb640, 0x00000000037fb8b8]
Event: 191.395 Thread 0x000000001da64000 2534       3       org.apache.xerces.impl.xs.opti.SchemaDOM::endElement (30 bytes)
Event: 191.395 Thread 0x000000001da64000 nmethod 2534 0x0000000003825750 code [0x00000000038258c0, 0x0000000003825b90]
Event: 191.423 Thread 0x000000001c13e000 nmethod 2535 0x000000000384fe10 code [0x0000000003850000, 0x0000000003850fe0]


---------------  S Y S T E M  ---------------

OS: Windows 8.1 , 64 bit Build 9600 (6.3.9600.17415)

CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 58 stepping 9, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, aes, clmul, erms, ht, tsc, tscinvbit, tscinv

Memory: 4k page, physical 16442864k(1810952k free), swap 19025808k(6260k free)

vm_info: Java HotSpot(TM) 64-Bit Server VM (25.92-b14) for windows-amd64 JRE (1.8.0_92-b14), built on Mar 31 2016 21:03:04 by "java_re" with MS VC++ 10.0 (VS2010)

time: Mon May 23 12:38:20 2016
elapsed time: 191 seconds (0d 0h 3m 11s)

默認情況下,Java不使用所有可用內存。 您需要使用相應的參數運行應用程序。

請參閱此問題以獲取所有詳細信息。 (它可以隨Java版本而改變)。

可以在命令行上設置參數設置,但如果使用應用程序,則可能有一些配置文件。 例如,在Eclipse中,您可以使用eclipse.ini設置內存首選項。

有些程序使用大量內存,如Elasticsearch,如果使用這種內存密集型程序,請嘗試添加更多內存

我在Windows 10和8.1(均為64位)上運行相同的Java應用程序時獲得了類似的內存轉儲。

Windows 8.1

32GB RAM

i7-4790 3.60GHz CPU

分頁文件大小(固定,14GB)

Windows 10

16GB RAM

i7-4790 3.60GHz CPU

分頁文件大小(自動管理,最初是固定的,14GB)

第一個問題是,使用相同的硬件(僅RAM和操作系統的差異),Windwos 10上的應用程序幾乎立即崩潰。 最令人驚訝的是,在任務管理器中,我看到只使用了25%的RAM。

在谷歌搜索信息后,我發現:

  1. 我需要為Windows 10設置自動管理的頁面文件。
  2. 與以前版本的Windows相比,Windows 10提交的內存更加貪婪

第二期

正如@borjab所提到的那樣

默認情況下,Java不使用所有可用內存。

要獲得有關CMD中Java類型的非標准選項的幫助,請執行以下操作:

java -X

輸出:

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

<size>可以在中定義

G - Gigabytes  
M - Megabytes  
K - Kilobytes

兩種操作系統的最終解決方案是:

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

我最初的java版本

java版“1.8.0_91”

Java(TM)SE運行時環境(版本1.8.0_91-b14)

Java HotSpot(TM)64位服務器VM(內置25.91-b14,混合模式)

更新了java版本

java版“1.8.0_152”

Java(TM)SE運行時環境(版本1.8.0_152-b16)

Java HotSpot(TM)64位服務器VM(內置25.152-b16,混合模式)

默認情況下,您的應用程序不使用所有可用的系統內存(或RAM)。 限制取決於您設置的xmx值。

不確定64位是否是您的選項,如果是,這可以讓您比32位版本增加xmx。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM