簡體   English   中英

內存不足,無法運行Java Runtime環境

[英]Insufficient memory to run Java Runtime environment to continue

我有一個帶有4 GB RAM的Windows OS系統。 我安裝了VMWare,以設置具有2GB RAM的Ubuntu虛擬機。 在Ubuntu中,我打開Eclipse並開始編碼,而Eclipse一次又一次關閉,並且開始出現以下錯誤:

 There is insufficient memory for the Java Runtime Environment to continue.     Native memory allocation (mmap) failed to map 28311552 bytes for     committing reserved memory.
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 (os_linux.cpp:2640), pid=4608, tid=0x6dc6eb40

 JRE version: Java(TM) SE Runtime Environment (8.0_161-b12) (build 1.8.0_161-b12)
 Java VM: Java HotSpot(TM) Client VM (25.161-b12 mixed mode linux-x86 )
 Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again


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

Current thread (0x099ab400):  VMThread [stack: 0x6dbee000,0x6dc6f000] [id=4629]

Stack: [0x6dbee000,0x6dc6f000],  sp=0x6dc6d240,  free space=508k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x5bffaf]  VMError::report_and_die()+0x16f
V  [libjvm.so+0x20e115]  report_vm_out_of_memory(char const*, int, unsigned int, VMErrorType, char const*)+0x55
V  [libjvm.so+0x4a2686]  os::Linux::commit_memory_impl(char*, unsigned int, bool)+0xe6
V  [libjvm.so+0x4a2afd]  os::pd_commit_memory_or_exit(char*, unsigned int, unsigned int, bool, char const*)+0x2d
V  [libjvm.so+0x49c660]  os::commit_memory_or_exit(char*, unsigned int, unsigned int, bool, char const*)+0x30
V  [libjvm.so+0x2741ad]  G1PageBasedVirtualSpace::commit_internal(unsigned int, unsigned int)+0x9d
V  [libjvm.so+0x27440c]  G1PageBasedVirtualSpace::commit(unsigned int, unsigned int)+0xfc
V  [libjvm.so+0x276a68]  G1RegionsLargerThanCommitSizeMapper::commit_regions(unsigned int, unsigned int)+0x28
V  [libjvm.so+0x2bc2ba]  HeapRegionManager::commit_regions(unsigned int, unsigned int)+0x5a
V  [libjvm.so+0x2bd343]  HeapRegionManager::make_regions_available(unsigned int, unsigned int)+0x23
V  [libjvm.so+0x2bd851]  HeapRegionManager::expand_by(unsigned int)+0xa1
V  [libjvm.so+0x250a7c]  G1CollectedHeap::expand(unsigned int)+0x11c
V  [libjvm.so+0x25b3fa]  G1CollectedHeap::do_collection_pause_at_safepoint(double)+0xd5a
V  [libjvm.so+0x5cbafe]  VM_G1IncCollectionPause::doit()+0x6e
V  [libjvm.so+0x5caad7]  VM_Operation::evaluate()+0x47
V  [libjvm.so+0x5c8ba3]  VMThread::evaluate_operation(VM_Operation*)+0xb3
V  [libjvm.so+0x5c8f40]  VMThread::loop()+0x1b0
V  [libjvm.so+0x5c93a5]  VMThread::run()+0x85
V  [libjvm.so+0x4a5219]  java_start(Thread*)+0x119
C  [libpthread.so.0+0x6295]  start_thread+0xe5

VM_Operation (0xbfbfede0): G1IncCollectionPause, mode: safepoint, requested by thread 0x0988f800

--------------  P R O C E S S  ---------------

Java虛擬機進程的內存不足

有幾種可能的方法。 我認為,如果您想保留該流程的當前限制,以下可能性是最有前途的:

  • 減小 Java堆大小( -Xmx / -Xms ):
    eclipse.ini ,可能存在類似於-Xmx1024m的行,您可以將其替換為-Xmx640m 嘗試哪個最大堆空間仍然足以滿足您的需求。 確保-Xms不大於-Xmx
  • 當且僅當您有64位系統時,才可以使用Eclipse 64位和Eclipse OpenJ9代替當前使用 Eclipse 32位和Java HotSpot 32位VM 默認情況下,OpenJ9在內存消耗方面更為高效,並且在這方面也可以進行進一步調整。

此處似乎未正確給出Use 64 bit Java on a 64 bit OS的可能性,因為64位Java VM可以尋址更多內存,但與等效的32位VM相比,內存效率較低。

您的可用內存太少了。 最好是用更多的內存來升級您的系統。

除非您有充分的理由不直接在Windows下使用eclipse,而不使用虛擬框。 如果必須使用Ubuntu,請考慮使用32位版本的Ubuntu和Java和eclipse,或將Ubuntu安裝在Windows旁邊,以便啟動它並擁有所有的內存。

暫無
暫無

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

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