我遇到的问题是java虚拟机根本没有足够的内存来编译。我该怎么办呢?
jvm由eclipse运行,它已经是64位服务器的一部分。我在一个类中运行大约600行代码,依赖于其他几个类,读取数据并保存在文本文件中。
错误报告如下所示
There is insufficient memory for the Java Runtime Environment to continue.
Native memory allocation (malloc) failed to allocate 1048576 bytes for
AllocateHeap
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 (memory/allocation.inline.hpp:61), pid=25196,
tid=0x0000000000006218
JRE version: (8.0_144-b01) (build )
Java VM: Java HotSpot(TM) 64-Bit Server VM (25.144-b01 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 ---------------
Current thread (0x00000000023a0800): JavaThread "Unknown thread"
[_thread_in_vm, id=25112, stack(0x00000000021b0000,0x00000000022b0000)]
Stack: [0x00000000021b0000,0x00000000022b0000]
[error occurred during error reporting (printing stack bounds), id
0xc0000005]
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native
code)
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
Other Threads:
=>0x00000000023a0800 (exited) JavaThread "Unknown thread" [_thread_in_vm,
id=25112, stack(0x00000000021b0000,0x00000000022b0000)]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap:
PSYoungGen total 37888K, used 655K [0x00000000d6400000,
0x00000000d8e00000, 0x0000000100000000)
eden space 32768K, 2% used
[0x00000000d6400000,0x00000000d64a3d80,0x00000000d8400000)
from space 5120K, 0% used
[0x00000000d8900000,0x00000000d8900000,0x00000000d8e00000)
to space 5120K, 0% used
[0x00000000d8400000,0x00000000d8400000,0x00000000d8900000)
ParOldGen total 86016K, used 0K [0x0000000082c00000,
0x0000000088000000, 0x00000000d6400000)
object space 86016K, 0% used
[0x0000000082c00000,0x0000000082c00000,0x0000000088000000)
Metaspace used 746K, capacity 4480K, committed 4480K, reserved
1056768K
class space used 75K, capacity 384K, committed 384K, reserved 1048576K
Card table byte_map: [0x0000000011860000,0x0000000011c50000] byte_map_base:
0x000000001144a000
Marking Bits: (ParMarkBitMap*) 0x000000006bb9d850
Begin Bits: [0x00000000122f0000, 0x0000000014240000)
End Bits: [0x0000000014240000, 0x0000000016190000)
Polling page: 0x0000000000630000
CodeCache: size=245760Kb used=328Kb max_used=328Kb free=245431Kb
bounds [0x00000000024a0000, 0x0000000002710000, 0x00000000114a0000]
total_blobs=58 nmethods=0 adapters=38
compilation: enabled
Compilation events (0 events):
No events
GC Heap History (0 events):
No events
Deoptimization events (0 events):
No events
Internal exceptions (0 events):
No events
Events (10 events):
Event: 0.310 loading class java/lang/Short
Event: 0.311 loading class java/lang/Short done
Event: 0.311 loading class java/lang/Integer
Event: 0.312 loading class java/lang/Integer done
Event: 0.312 loading class java/lang/Long
Event: 0.313 loading class java/lang/Long done
Event: 0.320 loading class java/lang/NullPointerException
Event: 0.320 loading class java/lang/NullPointerException done
Event: 0.320 loading class java/lang/ArithmeticException
Event: 0.320 loading class java/lang/ArithmeticException done
--------------- S Y S T E M ---------------
OS: Windows 10.0 , 64 bit Build 14393 (10.0.14393.1198)
CPU:total 4 (initial active 4) (2 cores per cpu, 2 threads per core) family
6 model 78 stepping 3, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1,
sse4.2, popcnt, avx, avx2, aes, clmul, erms, 3dnowpref, lzcnt, ht, tsc,
tscinvbit, bmi1, bmi2, adx
Memory: 4k page, physical 8204552k(3151664k free), swap 33370376k(6360k
free)
vm_info: Java HotSpot(TM) 64-Bit Server VM (25.144-b01) for windows-amd64
JRE (1.8.0_144-b01), built on Jul 21 2017 21:57:33 by "java_re" with MS VC++
10.0 (VS2010)
time: Sat Nov 04 21:20:44 2017
elapsed time: 0 seconds (0d 0h 0m 0s)