这是此主题的后续行动:Java Runtime.getRuntime().freeMemory() issues。我在该主题中得到了一些有用的建议,现在对主要问题有了更清晰的认识。在那个线程中,他们提出他们的主要问题是声明一个需要大量连续内存的大型二维数组;但是,即使在通过分别声明数组的每一行来解决该问题之后,我也看到了类似的问题。
我正在尝试声明一个大的二维数组,并且我的程序在声明期间的某个时候已经崩溃并且内存不足,尽管显然有足够的可用空间。而不是用
声明它float[][] A = new float[NUM_SEQ_TOTAL_P1][NUM_SEQ_TOTAL_P2];
我通过以下方式声明它,以减少必要的连续内存量。我也在每行初始化后打印可用内存量,以便找出问题所在。
float[][] A = new float[NUM_SEQ_TOTAL_P1][];
if (VERBOSE) {
System.out.println("After initial array allocation");
maxMemory = Runtime.getRuntime().maxMemory();
allocatedMemory = Runtime.getRuntime().totalMemory();
freeMemory = Runtime.getRuntime().freeMemory();
totalFreeMemory = freeMemory + (maxMemory - allocatedMemory);
System.out.println("free memory: " + freeMemory);
System.out.println("allocated memory: " + allocatedMemory);
System.out.println("max memory: " + maxMemory);
System.out.println("total free memory: " + totalFreeMemory);
}
for (int i = 0; i < NUM_SEQ_TOTAL_P1; ++i) {
A[i] = new float[NUM_SEQ_TOTAL_P2];
if (VERBOSE) {
System.out.println("After allocation for row " + i);
maxMemory = Runtime.getRuntime().maxMemory();
allocatedMemory = Runtime.getRuntime().totalMemory();
freeMemory = Runtime.getRuntime().freeMemory();
totalFreeMemory = freeMemory + (maxMemory - allocatedMemory);
System.out.println("free memory: " + freeMemory);
System.out.println("allocated memory: " + allocatedMemory);
System.out.println("max memory: " + maxMemory);
System.out.println("total free memory: " + totalFreeMemory);
}
}
在NUM_SEQ_TOTAL_P1 = 13001,NUM_SEQ_TOTAL_P2 = 12501的示例实例上运行此操作时,程序在尝试初始化行12009时崩溃,尽管看起来有大约1.4G的可用内存。
以下是崩溃前的输出:
After allocation for row 12007
free memory: 1206742048
allocated memory: 6688342016
max memory: 6990856192
total free memory: 1509256224
After allocation for row 12008
free memory: 1206742048
allocated memory: 6688342016
max memory: 6990856192
total free memory: 1509256224
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000755600000, 203948032, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 203948032 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /home/ubuntu/submission_2pn/ACPC2014_Agent/hs_err_pid22209.log
以下是错误文件hs_err_pid22209.log的内容(为了简洁,省略了&#34;动态库&#34;部分)。
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 203948032 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:2769), pid=22209, tid=140261598435072
#
# JRE version: OpenJDK Runtime Environment (7.0_55-b14) (build 1.7.0_55-b14)
# Java VM: OpenJDK 64-Bit Server VM (24.51-b03 mixed mode linux-amd64 compressed oops)
# 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 (0x00007f913c071000): VMThread [stack: 0x00007f9132b01000,0x00007f9132c02000] [id=22213]
Stack: [0x00007f9132b01000,0x00007f9132c02000], sp=0x00007f9132c00470, free space=1021k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x917b35] VMError::report_and_die()+0x175
V [libjvm.so+0x468144] report_vm_out_of_memory(char const*, int, unsigned long, char const*)+0x74
V [libjvm.so+0x79a81b] os::pd_commit_memory(char*, unsigned long, unsigned long, bool)+0x20b
V [libjvm.so+0x7950df] os::commit_memory(char*, unsigned long, unsigned long, bool)+0x1f
V [libjvm.so+0x8053cb] PSVirtualSpace::expand_by(unsigned long)+0x5b
V [libjvm.so+0x7f519b] PSOldGen::expand_by(unsigned long) [clone .part.80]+0x1b
V [libjvm.so+0x7f535b] PSOldGen::expand(unsigned long) [clone .part.81]+0xdb
V [libjvm.so+0x7f6288] PSOldGen::resize(unsigned long)+0x188
V [libjvm.so+0x7fd2e3] PSParallelCompact::invoke_no_policy(bool)+0x9c3
V [libjvm.so+0x80350d] PSScavenge::invoke()+0x17d
V [libjvm.so+0x7b9b33] ParallelScavengeHeap::failed_mem_allocate(unsigned long)+0x63
V [libjvm.so+0x919544] VM_ParallelGCFailedAllocation::doit()+0x84
V [libjvm.so+0x91d9e7] VM_Operation::evaluate()+0x47
V [libjvm.so+0x91c3b8] VMThread::evaluate_operation(VM_Operation*)+0x318
V [libjvm.so+0x91c819] VMThread::loop()+0x219
V [libjvm.so+0x91cc62] VMThread::run()+0x72
V [libjvm.so+0x7974e2] java_start(Thread*)+0xf2
VM_Operation (0x00007f91448863a0): ParallelGCFailedAllocation, mode: safepoint, requested by thread 0x00007f913c00a000
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x00007f913c0a1800 JavaThread "Service Thread" daemon [_thread_blocked, id=22219, stack(0x00007f9132372000,0x00007f9132473000)]
0x00007f913c09f000 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=22218, stack(0x00007f9132473000,0x00007f9132574000)]
0x00007f913c09c000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=22217, stack(0x00007f9132574000,0x00007f9132675000)]
0x00007f913c09a000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=22216, stack(0x00007f9132675000,0x00007f9132776000)]
0x00007f913c077800 JavaThread "Finalizer" daemon [_thread_blocked, id=22215, stack(0x00007f91328ff000,0x00007f9132a00000)]
0x00007f913c075800 JavaThread "Reference Handler" daemon [_thread_blocked, id=22214, stack(0x00007f9132a00000,0x00007f9132b01000)]
0x00007f913c00a000 JavaThread "main" [_thread_blocked, id=22210, stack(0x00007f9144787000,0x00007f9144888000)]
Other Threads:
=>0x00007f913c071000 VMThread [stack: 0x00007f9132b01000,0x00007f9132c02000] [id=22213]
0x00007f913c0ac000 WatcherThread [stack: 0x00007f9132271000,0x00007f9132372000] [id=22220]
VM state:at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: ([mutex/lock_event])
[0x00007f913c005ea0] ExpandHeap_lock - owner thread: 0x00007f913c071000
[0x00007f913c006520] Threads_lock - owner thread: 0x00007f913c071000
[0x00007f913c006a20] Heap_lock - owner thread: 0x00007f913c00a000
Heap
PSYoungGen total 1707008K, used 0K [0x0000000763c00000, 0x0000000800000000, 0x0000000800000000)
eden space 854016K, 0% used [0x0000000763c00000,0x0000000763c00000,0x0000000797e00000)
from space 852992K, 0% used [0x00000007cbf00000,0x00000007cbf00000,0x0000000800000000)
to space 852992K, 0% used [0x0000000797e00000,0x0000000797e00000,0x00000007cbf00000)
ParOldGen total 4884480K, used 3291458K [0x000000062b400000, 0x0000000755600000, 0x0000000763c00000)
object space 4884480K, 67% used [0x000000062b400000,0x00000006f4250948,0x0000000755600000)
PSPermGen total 21504K, used 5552K [0x0000000620e00000, 0x0000000622300000, 0x000000062b400000)
object space 21504K, 25% used [0x0000000620e00000,0x000000062136c2a8,0x0000000622300000)
Card table byte_map: [0x00007f9140502000,0x00007f91413fc000] byte_map_base: 0x00007f913d3fb000
Polling page: 0x00007f9144898000
Code Cache [0x00007f9139000000, 0x00007f9139280000, 0x00007f913c000000)
total_blobs=673 nmethods=393 adapters=234 free_code_cache=46719Kb largest_free_block=47718656
Compilation events (10 events):
Event: 822.060 Thread 0x00007f913c09c000 414 playingAgent.tartanian7.PlayerAction::access$0 (5 bytes)
Event: 822.061 Thread 0x00007f913c09c000 nmethod 414 0x00007f913909a490 code [0x00007f913909a5c0, 0x00007f913909a618]
Event: 825.774 Thread 0x00007f913c09f000 415 playingAgent.tartanian7.PokerUtils::countRoundDelimiters (42 bytes)
Event: 825.777 Thread 0x00007f913c09f000 nmethod 415 0x00007f913910cb10 code [0x00007f913910cc60, 0x00007f913910ce78]
Event: 833.158 Thread 0x00007f913c09c000 416 sun.misc.FloatingDecimal::<init> (205 bytes)
Event: 833.160 Thread 0x00007f913c09c000 nmethod 416 0x00007f9139252e50 code [0x00007f9139252fa0, 0x00007f9139253148]
Event: 868.741 Thread 0x00007f913c09f000 417 playingAgent.riverSolver.DoylesGameRiver2::getRiverStrategy (451 bytes)
Event: 869.143 Thread 0x00007f913c09f000 nmethod 417 0x00007f913926b790 code [0x00007f913926c300, 0x00007f9139276030]
Event: 873.572 Thread 0x00007f913c09c000 418 java.lang.String::toString (2 bytes)
Event: 873.573 Thread 0x00007f913c09c000 nmethod 418 0x00007f9139204350 code [0x00007f9139204480, 0x00007f91392044d8]
GC Heap History (10 events):
Event: 870.681 GC heap after
Heap after GC invocations=296 (full 26):
PSYoungGen total 1589760K, used 155692K [0x0000000763c00000, 0x00000007f9700000, 0x0000000800000000)
eden space 746496K, 0% used [0x0000000763c00000,0x0000000763c00000,0x0000000791500000)
from space 843264K, 18% used [0x00000007c5f80000,0x00000007cf78b148,0x00000007f9700000)
to space 852992K, 0% used [0x0000000791500000,0x0000000791500000,0x00000007c5600000)
ParOldGen total 4884480K, used 4320346K [0x000000062b400000, 0x0000000755600000, 0x0000000763c00000)
object space 4884480K, 88% used [0x000000062b400000,0x0000000732f16a70,0x0000000755600000)
PSPermGen total 21504K, used 5550K [0x0000000620e00000, 0x0000000622300000, 0x000000062b400000)
object space 21504K, 25% used [0x0000000620e00000,0x000000062136baa8,0x0000000622300000)
}
Event: 887.064 GC heap before
{Heap before GC invocations=297 (full 26):
PSYoungGen total 1589760K, used 902188K [0x0000000763c00000, 0x00000007f9700000, 0x0000000800000000)
eden space 746496K, 100% used [0x0000000763c00000,0x0000000791500000,0x0000000791500000)
from space 843264K, 18% used [0x00000007c5f80000,0x00000007cf78b148,0x00000007f9700000)
to space 852992K, 0% used [0x0000000791500000,0x0000000791500000,0x00000007c5600000)
ParOldGen total 4884480K, used 4320346K [0x000000062b400000, 0x0000000755600000, 0x0000000763c00000)
object space 4884480K, 88% used [0x000000062b400000,0x0000000732f16a70,0x0000000755600000)
PSPermGen total 21504K, used 5552K [0x0000000620e00000, 0x0000000622300000, 0x000000062b400000)
object space 21504K, 25% used [0x0000000620e00000,0x000000062136c000,0x0000000622300000)
Event: 887.089 GC heap after
Heap after GC invocations=297 (full 26):
PSYoungGen total 1599488K, used 19832K [0x0000000763c00000, 0x00000007fc580000, 0x0000000800000000)
eden space 746496K, 0% used [0x0000000763c00000,0x0000000763c00000,0x0000000791500000)
from space 852992K, 2% used [0x0000000791500000,0x000000079285e170,0x00000007c5600000)
to space 852992K, 0% used [0x00000007c8480000,0x00000007c8480000,0x00000007fc580000)
ParOldGen total 4884480K, used 4320346K [0x000000062b400000, 0x0000000755600000, 0x0000000763c00000)
object space 4884480K, 88% used [0x000000062b400000,0x0000000732f16a70,0x0000000755600000)
PSPermGen total 21504K, used 5552K [0x0000000620e00000, 0x0000000622300000, 0x000000062b400000)
object space 21504K, 25% used [0x0000000620e00000,0x000000062136c000,0x0000000622300000)
}
Event: 887.429 GC heap before
{Heap before GC invocations=298 (full 26):
PSYoungGen total 1599488K, used 766328K [0x0000000763c00000, 0x00000007fc580000, 0x0000000800000000)
eden space 746496K, 100% used [0x0000000763c00000,0x0000000791500000,0x0000000791500000)
from space 852992K, 2% used [0x0000000791500000,0x000000079285e170,0x00000007c5600000)
to space 852992K, 0% used [0x00000007c8480000,0x00000007c8480000,0x00000007fc580000)
ParOldGen total 4884480K, used 4320346K [0x000000062b400000, 0x0000000755600000, 0x0000000763c00000)
object space 4884480K, 88% used [0x000000062b400000,0x0000000732f16a70,0x0000000755600000)
PSPermGen total 21504K, used 5552K [0x0000000620e00000, 0x0000000622300000, 0x000000062b400000)
object space 21504K, 25% used [0x0000000620e00000,0x000000062136c000,0x0000000622300000)
Event: 887.799 GC heap after
Heap after GC invocations=298 (full 26):
PSYoungGen total 1647104K, used 757446K [0x0000000763c00000, 0x00000007fe780000, 0x0000000800000000)
eden space 794112K, 0% used [0x0000000763c00000,0x0000000763c00000,0x0000000794380000)
from space 852992K, 88% used [0x00000007c8480000,0x00000007f6831848,0x00000007fc580000)
to space 852992K, 0% used [0x0000000794380000,0x0000000794380000,0x00000007c8480000)
ParOldGen total 4884480K, used 4320346K [0x000000062b400000, 0x0000000755600000, 0x0000000763c00000)
object space 4884480K, 88% used [0x000000062b400000,0x0000000732f16a70,0x0000000755600000)
PSPermGen total 21504K, used 5552K [0x0000000620e00000, 0x0000000622300000, 0x000000062b400000)
object space 21504K, 25% used [0x0000000620e00000,0x000000062136c000,0x0000000622300000)
}
Event: 921.229 GC heap before
{Heap before GC invocations=299 (full 26):
PSYoungGen total 1647104K, used 1551558K [0x0000000763c00000, 0x00000007fe780000, 0x0000000800000000)
eden space 794112K, 100% used [0x0000000763c00000,0x0000000794380000,0x0000000794380000)
from space 852992K, 88% used [0x00000007c8480000,0x00000007f6831848,0x00000007fc580000)
to space 852992K, 0% used [0x0000000794380000,0x0000000794380000,0x00000007c8480000)
ParOldGen total 4884480K, used 4320346K [0x000000062b400000, 0x0000000755600000, 0x0000000763c00000)
object space 4884480K, 88% used [0x000000062b400000,0x0000000732f16a70,0x0000000755600000)
PSPermGen total 21504K, used 5552K [0x0000000620e00000, 0x0000000622300000, 0x000000062b400000)
object space 21504K, 25% used [0x0000000620e00000,0x000000062136c2a8,0x0000000622300000)
Event: 921.312 GC heap after
Heap after GC invocations=299 (full 26):
PSYoungGen total 1647104K, used 238543K [0x0000000763c00000, 0x0000000800000000, 0x0000000800000000)
eden space 794112K, 0% used [0x0000000763c00000,0x0000000763c00000,0x0000000794380000)
from space 852992K, 27% used [0x0000000794380000,0x00000007a2c73d88,0x00000007c8480000)
to space 852992K, 0% used [0x00000007cbf00000,0x00000007cbf00000,0x0000000800000000)
ParOldGen total 4884480K, used 4320469K [0x000000062b400000, 0x0000000755600000, 0x0000000763c00000)
object space 4884480K, 88% used [0x000000062b400000,0x0000000732f35658,0x0000000755600000)
PSPermGen total 21504K, used 5552K [0x0000000620e00000, 0x0000000622300000, 0x000000062b400000)
object space 21504K, 25% used [0x0000000620e00000,0x000000062136c2a8,0x0000000622300000)
}
Event: 922.006 GC heap before
{Heap before GC invocations=300 (full 26):
PSYoungGen total 1647104K, used 1032655K [0x0000000763c00000, 0x0000000800000000, 0x0000000800000000)
eden space 794112K, 100% used [0x0000000763c00000,0x0000000794380000,0x0000000794380000)
from space 852992K, 27% used [0x0000000794380000,0x00000007a2c73d88,0x00000007c8480000)
to space 852992K, 0% used [0x00000007cbf00000,0x00000007cbf00000,0x0000000800000000)
ParOldGen total 4884480K, used 4320469K [0x000000062b400000, 0x0000000755600000, 0x0000000763c00000)
object space 4884480K, 88% used [0x000000062b400000,0x0000000732f35658,0x0000000755600000)
PSPermGen total 21504K, used 5552K [0x0000000620e00000, 0x0000000622300000, 0x000000062b400000)
object space 21504K, 25% used [0x0000000620e00000,0x000000062136c2a8,0x0000000622300000)
Event: 922.276 GC heap after
Heap after GC invocations=300 (full 26):
PSYoungGen total 1707008K, used 777281K [0x0000000763c00000, 0x0000000800000000, 0x0000000800000000)
eden space 854016K, 0% used [0x0000000763c00000,0x0000000763c00000,0x0000000797e00000)
from space 852992K, 91% used [0x00000007cbf00000,0x00000007fb610478,0x0000000800000000)
to space 852992K, 0% used [0x0000000797e00000,0x0000000797e00000,0x00000007cbf00000)
ParOldGen total 4884480K, used 4557979K [0x000000062b400000, 0x0000000755600000, 0x0000000763c00000)
object space 4884480K, 93% used [0x000000062b400000,0x0000000741726ce0,0x0000000755600000)
PSPermGen total 21504K, used 5552K [0x0000000620e00000, 0x0000000622300000, 0x000000062b400000)
object space 21504K, 25% used [0x0000000620e00000,0x000000062136c2a8,0x0000000622300000)
}
Event: 922.277 GC heap before
{Heap before GC invocations=301 (full 27):
PSYoungGen total 1707008K, used 777281K [0x0000000763c00000, 0x0000000800000000, 0x0000000800000000)
eden space 854016K, 0% used [0x0000000763c00000,0x0000000763c00000,0x0000000797e00000)
from space 852992K, 91% used [0x00000007cbf00000,0x00000007fb610478,0x0000000800000000)
to space 852992K, 0% used [0x0000000797e00000,0x0000000797e00000,0x00000007cbf00000)
ParOldGen total 4884480K, used 4557979K [0x000000062b400000, 0x0000000755600000, 0x0000000763c00000)
object space 4884480K, 93% used [0x000000062b400000,0x0000000741726ce0,0x0000000755600000)
PSPermGen total 21504K, used 5552K [0x0000000620e00000, 0x0000000622300000, 0x000000062b400000)
object space 21504K, 25% used [0x0000000620e00000,0x000000062136c2a8,0x0000000622300000)
Deoptimization events (10 events):
Event: 407.398 Thread 0x00007f913c00a000 Uncommon trap: reason=array_check action=maybe_recompile pc=0x00007f913922585c method=java.util.ComparableTimSort.mergeLo(IIII)V @ 461
Event: 407.399 Thread 0x00007f913c00a000 Uncommon trap: reason=array_check action=maybe_recompile pc=0x00007f9139227f38 method=java.util.ComparableTimSort.mergeHi(IIII)V @ 234
Event: 418.240 Thread 0x00007f913c00a000 Uncommon trap: reason=array_check action=maybe_recompile pc=0x00007f9139223518 method=java.util.ComparableTimSort.mergeHi(IIII)V @ 642
Event: 418.240 Thread 0x00007f913c00a000 Uncommon trap: reason=array_check action=maybe_recompile pc=0x00007f9139223160 method=java.util.ComparableTimSort.mergeHi(IIII)V @ 404
Event: 418.240 Thread 0x00007f913c00a000 Uncommon trap: reason=array_check action=maybe_recompile pc=0x00007f9139223160 method=java.util.ComparableTimSort.mergeHi(IIII)V @ 404
Event: 451.264 Thread 0x00007f913c00a000 Uncommon trap: reason=array_check action=maybe_recompile pc=0x00007f913924bf94 method=java.util.ComparableTimSort.mergeLo(IIII)V @ 129
Event: 451.264 Thread 0x00007f913c00a000 Uncommon trap: reason=array_check action=maybe_recompile pc=0x00007f913922ad98 method=java.util.ComparableTimSort.mergeHi(IIII)V @ 509
Event: 451.264 Thread 0x00007f913c00a000 Uncommon trap: reason=array_check action=maybe_recompile pc=0x00007f913922ad98 method=java.util.ComparableTimSort.mergeHi(IIII)V @ 509
Event: 610.071 Thread 0x00007f913c00a000 Uncommon trap: reason=array_check action=maybe_recompile pc=0x00007f913924bf94 method=java.util.ComparableTimSort.mergeLo(IIII)V @ 129
Event: 823.140 Thread 0x00007f913c00a000 Uncommon trap: reason=array_check action=maybe_recompile pc=0x00007f91392518f8 method=java.util.ComparableTimSort.mergeHi(IIII)V @ 160
Internal exceptions (10 events):
Event: 85.592 Thread 0x00007f913c00a000 Threw 0x0000000765556120 at /build/buildd/openjdk-7-7u55-2.4.7/build/openjdk/hotspot/src/share/vm/prims/jvm.cpp:1244
Event: 85.602 Thread 0x00007f913c00a000 Threw 0x000000076555a348 at /build/buildd/openjdk-7-7u55-2.4.7/build/openjdk/hotspot/src/share/vm/prims/jvm.cpp:1244
Event: 85.603 Thread 0x00007f913c00a000 Threw 0x000000076555ef18 at /build/buildd/openjdk-7-7u55-2.4.7/build/openjdk/hotspot/src/share/vm/prims/jvm.cpp:1244
Event: 85.604 Thread 0x00007f913c00a000 Threw 0x0000000765562328 at /build/buildd/openjdk-7-7u55-2.4.7/build/openjdk/hotspot/src/share/vm/prims/jvm.cpp:1244
Event: 85.660 Thread 0x00007f913c00a000 Threw 0x000000076570ac68 at /build/buildd/openjdk-7-7u55-2.4.7/build/openjdk/hotspot/src/share/vm/prims/jvm.cpp:1244
Event: 88.562 Thread 0x00007f913c00a000 Threw 0x000000076637c7e8 at /build/buildd/openjdk-7-7u55-2.4.7/build/openjdk/hotspot/src/share/vm/prims/jvm.cpp:1244
Event: 88.563 Thread 0x00007f913c00a000 Threw 0x00000007663905b0 at /build/buildd/openjdk-7-7u55-2.4.7/build/openjdk/hotspot/src/share/vm/prims/jvm.cpp:1244
Event: 88.692 Thread 0x00007f913c00a000 Threw 0x000000076662db70 at /build/buildd/openjdk-7-7u55-2.4.7/build/openjdk/hotspot/src/share/vm/prims/jvm.cpp:1244
Event: 88.694 Thread 0x00007f913c00a000 Threw 0x00000007666351d8 at /build/buildd/openjdk-7-7u55-2.4.7/build/openjdk/hotspot/src/share/vm/prims/jvm.cpp:1244
Event: 88.697 Thread 0x00007f913c00a000 Threw 0x000000076664a640 at /build/buildd/openjdk-7-7u55-2.4.7/build/openjdk/hotspot/src/share/vm/prims/jvm.cpp:1244
Events (10 events):
Event: 834.875 Executing VM operation: ParallelGCFailedAllocation done
Event: 870.630 Executing VM operation: ParallelGCFailedAllocation
Event: 870.681 Executing VM operation: ParallelGCFailedAllocation done
Event: 887.064 Executing VM operation: ParallelGCFailedAllocation
Event: 887.089 Executing VM operation: ParallelGCFailedAllocation done
Event: 887.429 Executing VM operation: ParallelGCFailedAllocation
Event: 887.800 Executing VM operation: ParallelGCFailedAllocation done
Event: 921.224 Executing VM operation: ParallelGCFailedAllocation
Event: 921.312 Executing VM operation: ParallelGCFailedAllocation done
Event: 922.006 Executing VM operation: ParallelGCFailedAllocation
Dynamic libraries: [section omitted]
VM Arguments:
jvm_args: -Xmx7500m
java_command: playingAgent.tartanian7.HUNLHEServer 10.136.57.208 18374
Launcher Type: SUN_STANDARD
Environment Variables:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:Tartanian7Files/gurobi/gurobi563/linux64/bin
LD_LIBRARY_PATH=:Tartanian7Files/gurobi/gurobi563/linux64/lib
SHELL=/bin/bash
Signal Handlers:
SIGSEGV: [libjvm.so+0x918620], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGBUS: [libjvm.so+0x918620], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGFPE: [libjvm.so+0x795e30], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGPIPE: [libjvm.so+0x795e30], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGXFSZ: [libjvm.so+0x795e30], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGILL: [libjvm.so+0x795e30], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000
SIGUSR2: [libjvm.so+0x795cd0], sa_mask[0]=0x00000000, sa_flags=0x10000004
SIGHUP: [libjvm.so+0x795eb0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGINT: [libjvm.so+0x795eb0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGTERM: [libjvm.so+0x795eb0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGQUIT: [libjvm.so+0x795eb0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
--------------- S Y S T E M ---------------
OS:Ubuntu 14.04 (trusty)
uname:Linux 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64
libc:glibc 2.19 NPTL 2.19
rlimit: STACK 8192k, CORE 0k, NPROC 59937, NOFILE 4096, AS infinity
load average:1.69 1.63 1.14
/proc/meminfo:
MemTotal: 7693824 kB
MemFree: 122376 kB
Buffers: 1260 kB
Cached: 24844 kB
SwapCached: 0 kB
Active: 7465916 kB
Inactive: 16052 kB
Active(anon): 7455880 kB
Inactive(anon): 200 kB
Active(file): 10036 kB
Inactive(file): 15852 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 40 kB
Writeback: 0 kB
AnonPages: 7455848 kB
Mapped: 6080 kB
Shmem: 236 kB
Slab: 19748 kB
SReclaimable: 10880 kB
SUnreclaim: 8868 kB
KernelStack: 856 kB
PageTables: 18700 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 3846912 kB
Committed_AS: 7890140 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 14888 kB
VmallocChunk: 34359719127 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 7872512 kB
DirectMap2M: 0 kB
CPU:total 2 (16 cores per cpu, 2 threads per core) family 6 model 62 stepping 4, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, aes, erms, ht, tsc
/proc/cpuinfo:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
stepping : 4
microcode : 0x415
cpu MHz : 2500.058
cache size : 25600 KB
physical id : 1
siblings : 2
core id : 0
cpu cores : 1
apicid : 32
initial apicid : 32
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu de tsc msr pae cx8 apic sep cmov pat clflush mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nopl pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt tsc_deadline_timer aes rdrand hypervisor lahf_lm ida arat epb pln pts dtherm fsgsbase erms
bogomips : 5000.11
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
stepping : 4
microcode : 0x415
cpu MHz : 2500.058
cache size : 25600 KB
physical id : 1
siblings : 2
core id : 0
cpu cores : 1
apicid : 32
initial apicid : 32
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu de tsc msr pae cx8 apic sep cmov pat clflush mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nopl pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt tsc_deadline_timer aes rdrand hypervisor lahf_lm ida arat epb pln pts dtherm fsgsbase erms
bogomips : 5000.11
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
Memory: 4k page, physical 7693824k(122376k free), swap 0k(0k free)
vm_info: OpenJDK 64-Bit Server VM (24.51-b03) for linux-amd64 JRE (1.7.0_55-b14), built on Apr 17 2014 20:08:07 by "buildd" with gcc 4.8.2
time: Sat May 31 19:05:34 2014
elapsed time: 927 seconds
答案 0 :(得分:1)
查看nio字节缓冲区和allocateDirect。内存分配在JVM堆空间之外。您将需要进行一些代码重构工作,但由于您需要如此大的内存块ByteBuffers可能会让您感到宽慰。
来自JavaDoc
可以通过调用此类的allocateDirect工厂方法来创建直接字节缓冲区。与非直接缓冲区相比,此方法返回的缓冲区通常具有更高的分配和解除分配成本。直接缓冲区的内容可能位于正常的垃圾收集堆之外,因此它们对应用程序的内存占用量的影响可能并不明显。因此 建议直接缓冲区主要分配给受基础系统本机I / O操作影响的大型长期缓冲区 。通常,最好只在它们在程序性能上产生可测量的增益时才分配直接缓冲区。