64位windows操作系統下盡量不要使用32位JDK – JAVA編程語言程序開發技術文章

新產品發佈,拿來試用。由於本機是win7_x64,但是為方便工作,機器安裝瞭從32位的JDK1.5一直到64位的JDK1.6的4個JDK。為保證運行時能與大多數人的運行狀況相同,依然采用瞭32位的jdk1.6來運行產品。

結果,我第一次碰到應用服務器剛起來就crash的問題。

生成的JVM的錯誤日志如下:

[java]

# There is insufficient memory for the Java Runtime Environment to continue. 
# Native memory allocation (malloc) failed to allocate 678096 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:317), pid=2468, tid=2708 

# JRE version: 6.0_31-b05 
# Java VM: Java HotSpot(TM) Server VM (20.6-b01 mixed mode windows-x86 ) 
 
—————  T H R E A D  ————— 
 
Current thread (0x05f65c00):  JavaThread "C2 CompilerThread1" daemon [_thread_in_native, id=2708, stack(0x06320000,0x06370000)] 
 
Stack: [0x06320000,0x06370000],  sp=0x0636e594,  free space=313k 
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) 
 
[error occurred during error reporting (printing native stack), id 0xc0000005] 
 
 
Current CompileTask: 
C2:  66818 1186      com.sun.corba.se.impl.corba.TypeCodeImpl.read_value_body(Lorg/omg/CORBA_2_3/portable/InputStream;)V (1274 bytes) 
 
 
—————  P R O C E S S  ————— 
 
Java Threads: ( => current thread ) 
  0x08447000 JavaThread "Idle HTTPHandler-4" [_thread_blocked, id=7344, stack(0x0e320000,0x0e370000)] 
  0x08446800 JavaThread "Idle HTTPHandler-3" [_thread_blocked, id=4148, stack(0x0e290000,0x0e2e0000)] 
  0x08446000 JavaThread "Idle HTTPHandler-2" [_thread_blocked, id=5736, stack(0x0e200000,0x0e250000)] 
  0x08445c00 JavaThread "Idle ORBWorker-3" [_thread_blocked, id=6876, stack(0x0c460000,0x0c4b0000)] 
  0x08445400 JavaThread "Running ORBWorker-2" [_thread_in_vm, id=6612, stack(0x0c330000,0x0c380000)] 
  0x08445000 JavaThread "AS-Monitor Sampling Thread: ThreadMonitor" [_thread_blocked, id=7820, stack(0x0c290000,0x0c2e0000)] 
  0x08444800 JavaThread "AS-Monitor Sampling Thread: HttpConnectionMonitor" [_thread_blocked, id=7688, stack(0x0c200000,0x0c250000)] 
  0x06fb3c00 JavaThread "AS-Monitor Sampling Thread: DataSourcesMonitor" [_thread_blocked, id=1448, stack(0x0c170000,0x0c1c0000)] 
  0x07ffac00 JavaThread "AS-Monitor Sampling Thread: SessionsMonitor" [_thread_blocked, id=6160, stack(0x0c0e0000,0x0c130000)] 
  0x07ffa400 JavaThread "AS-Monitor Sampling Thread: JTAMonitor" [_thread_blocked, id=6844, stack(0x0c050000,0x0c0a0000)] 
  0x07ffa000 JavaThread "AS-Monitor Sampling Thread: ClassLoadMonitor" [_thread_blocked, id=7148, stack(0x0bfc0000,0x0c010000)] 
  0x07ff9800 JavaThread "AS-Monitor Sampling Thread: MemoryMonitor" [_thread_blocked, id=7428, stack(0x0bf30000,0x0bf80000)] 
  0x07ff9000 JavaThread "p: default-threadpool; w: Idle" daemon [_thread_blocked, id=4840, stack(0x0b4e0000,0x0b530000)] 
  0x07ff8c00 JavaThread "p: default-threadpool; w: Idle" daemon [_thread_blocked, id=6512, stack(0x0b440000,0x0b490000)] 
  0x07ff8400 JavaThread "Thread-19" daemon [_thread_blocked, id=7412, stack(0x0b230000,0x0b280000)] 
  0x07ff8000 JavaThread "JMX server connection timeout 64" daemon [_thread_blocked, id=2176, stack(0x0b180000,0x0b1d0000)] 
  0x07ff7800 JavaThread "p: default-threadpool; w: Idle" daemon [_thread_blocked, id=7128, stack(0x0b010000,0x0b060000)] 
  0x07ff7400 JavaThread "Idle ORBWorker-1" [_thread_blocked, id=7976, stack(0x0af60000,0x0afb0000)] 
  0x06fb4800 JavaThread "SelectorThread" daemon [_thread_in_native, id=3124, stack(0x0aec0000,0x0af10000)] 
  0x06fb4000 JavaThread "SelectorThread" daemon [_thread_in_native, id=2704, stack(0x0ae10000,0x0ae60000)] 
  0x06fb3400 JavaThread "pool-2-thread-1" [_thread_blocked, id=8036, stack(0x0a910000,0x0a960000)] 
  0x06fb2c00 JavaThread "Idle HTTPHandler-1" [_thread_blocked, id=6600, stack(0x0a7d0000,0x0a820000)] 
  0x06fb2800 JavaThread "HttpReader" [_thread_in_native, id=5532, stack(0x0a740000,0x0a790000)] 
  0x06fb2000 JavaThread "MuxReader" [_thread_in_native, id=6712, stack(0x0a6b0000,0x0a700000)] 
  0x06fb1c00 JavaThread "AutoDeployer" [_thread_blocked, id=6732, stack(0x0a1d0000,0x0a220000)] 
  0x06fb1400 JavaThread "MongoCleaner22152612" daemon [_thread_blocked, id=4764, stack(0x0a140000,0x0a190000)] 
  0x06fb1000 JavaThread "derby.rawStoreDaemon" daemon [_thread_blocked, id=8008, stack(0x0a0a0000,0x0a0f0000)] 
  0x06cfc000 JavaThread "Timer-2" daemon [_thread_blocked, id=6484, stack(0x09fe0000,0x0a030000)] 
  0x06cf8000 JavaThread "derby.antiGC" daemon [_thread_blocked, id=3232, stack(0x08fd0000,0x09020000)] 
  0x06cfb800 JavaThread "RMI TCP Connection(idle)" daemon [_thread_blocked, id=2936, stack(0x09ba0000,0x09bf0000)] 
  0x06cfb400 JavaThread "RMI TCP Connection(4)-192.168.0.70" daemon [_thread_blocked, id=7516, stack(0x095f0000,0x09640000)] 
  0x06cfac00 JavaThread "RMI TCP Connection(idle)" daemon [_thread_blocked, id=5808, stack(0x094d0000,0x09520000)] 
  0x06cfa800 JavaThread "RMI TCP Connection(2)-192.168.0.70" daemon [_thread_in_native, id=5784, stack(0x09430000,0x09480000)] 
  0x06cfa000 JavaThread "JMX server connection timeout 41" daemon [_thread_blocked, id=6264, stack(0x09320000,0x09370000)] 
  0x06cf9c00 JavaThread "RMI Scheduler(0)" daemon [_thread_blocked, id=8124, stack(0x09290000,0x092e0000)] 
  0x06cf9400 JavaThread "RMI TCP Connection(1)-192.168.0.70" daemon [_thread_in_native, id=8160, stack(0x09200000,0x09250000)] 
  0x06cf8800 JavaThread "RMI TCP Accept-0" daemon [_thread_in_native, id=6096, stack(0x091b0000,0x09200000)] 
  0x06cf7c00 JavaThread "derby.rawStoreDaemon" daemon [_thread_blocked, id=1388, stack(0x08f40000,0x08f90000)] 
  0x06cf7400 JavaThread "Timer-1" daemon [_thread_blocked, id=3912, stack(0x08eb0000,0x08f00000)] 
  0x06cf7000 JavaThread "derby.antiGC" daemon [_thread_blocked, id=6244, stack(0x08e20000,0x08e70000)] 
  0x06cf6000 JavaThread "Idle JMSHandler-4" [_thread_blocked, id=6420, stack(0x07dc0000,0x07e10000)] 
  0x06cf5c00 JavaThread "Idle JMSHandler-3" [_thread_blocked, id=7960, stack(0x07d30000,0x07d80000)] 
  0x06cf5400 JavaThread "Idle JMSHandler-2" [_thread_blocked, id=2436, stack(0x07ca0000,0x07cf0000)] 
  0x06cf5000 JavaThread "pool-1-thread-5" [_thread_blocked, id=5680, stack(0x07c10000,0x07c60000)] 
  0x06cf4800 JavaThread "JMSReader" [_thread_in_native, id=5280, stack(0x07b80000,0x07bd0000)] 
  0x06d50000 JavaThread "pool-1-thread-4" [_thread_blocked, id=5472, stack(0x07af0000,0x07b40000)] 
  0x06c2bc00 JavaThread "Timer-0" [_thread_blocked, id=5444, stack(0x07a60000,0x07ab0000)] 
  0x06c2b800 JavaThread "pool-1-thread-3" [_thread_blocked, id=5296, stack(0x079d0000,0x07a20000)] 
  0x06c2b000 JavaThread "Running JMSHandler-1" [_thread_blocked, id=7408, stack(0x07940000,0x07990000)] 
  0x06c2ac00 JavaThread "HTTPSessionSwapper" [_thread_blocked, id=6828, stack(0x078b0000,0x07900000)] 
  0x06c77c00 JavaThread "pool-1-thread-2" [_thread_blocked, id=3896, stack(0x07820000,0x07870000)] 
  0x07271800 JavaThread "Thread-3" [_thread_blocked, id=3180, stack(0x07790000,0x077e0000)] 
  0x06d2c400 JavaThread "MuxSecureListener" [_thread_in_native, id=7824, stack(0x076b0000,0x07700000)] 
  0x06ca2800 JavaThread "MuxListener" [_thread_in_native, id=8040, stack(0x068d0000,0x06920000)] 
  0x06bf5800 JavaThread "pool-1-thread-1" [_thread_blocked, id=6192, stack(0x06840000,0x06890000)] 
  0x06bf5400 JavaThread "LogManager" [_thread_blocked, id=1048, stack(0x06740000,0x06790000)] 
  0x05f69400 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=6396, stack(0x063b0000,0x06400000)] 
=>0x05f65c00 JavaThread "C2 CompilerThread1" daemon [_thread_in_native, id=2708, stack(0x06320000,0x06370000)] 
  0x05f3d400 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=4736, stack(0x06290000,0x062e0000)] 
  0x05f3ac00 JavaThread "Attach Listener" daemon [_thread_blocked, id=8056, stack(0x06200000,0x06250000)] 
  0x05f32000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=6720, stack(0x06170000,0x061c0000)] 
  0x027d2c00 JavaThread "Finalizer" daemon [_thread_blocked, id=2296, stack(0x05ee0000,0x05f30000)] 
  0x027d1800 JavaThread "Reference Handler" daemon [_thread_blocked, id=4972, stack(0x05e50000,0x05ea0000)] 
  0x004db800 JavaThread "main" [_thread_blocked, id=716, stack(0x00430000,0x00480000)] 
 
Other Threads: 
  0x027ce800 VMThread [stack: 0x05dc0000,0x05e10000] [id=5688] 
  0x05f72400 WatcherThread [stack: 0x06440000,0x06490000] [id=7564] 
 
VM state:not at safepoint (normal execution) 
 
VM Mutex/Monitor currently owned by a thread: None 
 
Heap 
 PSYoungGen      total 305856K, used 108523K [0x49ac0000, 0x5f010000, 0x5f010000) 
  eden space 262208K, 38% used [0x49ac0000,0x4fd23988,0x59ad0000) 
  from space 43648K, 17% used [0x5c570000,0x5cd075d8,0x5f010000) 
  to   space 43648K, 0% used [0x59ad0000,0x59ad0000,0x5c570000) 
 PSOldGen        total 699072K, used 11615K [0x1f010000, 0x49ac0000, 0x49ac0000) 
  object space 699072K, 1% used [0x1f010000,0x1fb67c70,0x49ac0000) 
 PSPermGen       total 78336K, used 58337K [0x0f010000, 0x13c90000, 0x1f010000) 
  object space 78336K, 74% used [0x0f010000,0x12908470,0x13c90000) 
 
Code Cache  [0x027e0000, 0x02b20000, 0x057e0000) 
 total_blobs=1388 nmethods=1153 adapters=188 free_code_cache=47006656 largest_free_block=29760 
 
Dynamic libraries: 
0x00400000 – 0x00425000     D:\Java\x86\jdk1.6.0_31\bin\java.exe 
0x77cf0000 – 0x77e70000     C:\Windows\SysWOW64\ntdll.dll 
0x74fb0000 – 0x750c0000     C:\Windows\syswow64\kernel32.dll 
0x750c0000 – 0x75106000     C:\Windows\syswow64\KERNELBASE.dll 
0x75200000 – 0x752a0000     C:\Windows\syswow64\ADVAPI32.dll 
0x76b60000 – 0x76c0c000     C:\Windows\syswow64\msvcrt.dll 
0x75690000 – 0x756a9000     C:\Windows\SysWOW64\sechost.dll 
0x77200000 – 0x772f0000     C:\Windows\syswow64\RPCRT4.dll 
0x74f40000 – 0x74fa0000     C:\Windows\syswow64\SspiCli.dll 
0x74f30000 – 0x74f3c000     C:\Windows\syswow64\CRYPTBASE.dll 
0x7c340000 – 0x7c396000     D:\Java\x86\jdk1.6.0_31\jre\bin\msvcr71.dll 
0x6db90000 – 0x6dfe8000     D:\Java\x86\jdk1.6.0_31\jre\bin\server\jvm.dll 
0x766d0000 – 0x767d0000     C:\Windows\syswow64\USER32.dll 
0x752a0000 – 0x75330000     C:\Windows\syswow64\GDI32.dll 
0x75680000 – 0x7568a000     C:\Windows\syswow64\LPK.dll 
0x76d10000 – 0x76dad000     C:\Windows\syswow64\USP10.dll 
0x767d0000 – 0x76802000     C:\Windows\syswow64\WINMM.dll 
0x76ca0000 – 0x76d00000     C:\Windows\system32\IMM32.DLL 
0x755b0000 – 0x7567c000     C:\Windows\syswow64\MSCTF.dll 
0x71ad0000 – 0x71b1c000     C:\Windows\system32\apphelp.dll 
0x72f80000 – 0x72fb2000     C:\Windows\SysWOW64\nvinit.dll 
0x0f000000 – 0x0f006000     C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\_etoured.dll 
0x71a90000 – 0x71acc000     C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\nvd3d9wrap.dll 
0x75710000 – 0x758ad000     C:\Windows\syswow64\SETUPAPI.dll 
0x75330000 – 0x75357000     C:\Windows\syswow64\CFGMGR32.dll 
0x758b0000 – 0x7593f000     C:\Windows\syswow64\OLEAUT32.dll 
0x76db0000 – 0x76f0c000     C:\Windows\syswow64\ole32.dll 
0x76840000 – 0x76852000     C:\Windows\syswow64\DEVOBJ.dll 
0x71a50000 – 0x71a8b000     C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\nvdxgiwrap.dll 
0x6d870000 – 0x6d87c000     D:\Java\x86\jdk1.6.0_31\jre\bin\verify.dll 
0x6d3d0000 – 0x6d3ef000     D:\Java\x86\jdk1.6.0_31\jre\bin\java.dll 
0x6d8b0000 – 0x6d8bf000     D:\Java\x86\jdk1.6.0_31\jre\bin\zip.dll 
0x6d6b0000 – 0x6d6c3000     D:\Java\x86\jdk1.6.0_31\jre\bin\net.dll 
0x76c10000 – 0x76c45000     C:\Windows\syswow64\WS2_32.dll 
0x75490000 – 0x75496000     C:\Windows\syswow64\NSI.dll 
0x722c0000 – 0x722fc000     C:\Windows\system32\mswsock.dll 
0x713f0000 – 0x713f6000     C:\Windows\System32\wship6.dll 
0x72510000 – 0x72520000     C:\Windows\system32\NLAapi.dll 
0x72500000 – 0x72510000     C:\Windows\system32\napinsp.dll 
0x72420000 – 0x72432000     C:\Windows\system32\pnrpnsp.dll 
0x72270000 – 0x722b4000     C:\Windows\system32\DNSAPI.dll 
0x724f0000 – 0x724f8000     C:\Windows\System32\winrnr.dll 
0x003e0000 – 0x003f7000     C:\Program Files (x86)\Common Files\Thunder Network\NetMon\net_monitor2.0.2.7.dll 
0x75a80000 – 0x766ca000     C:\Windows\syswow64\SHELL32.dll 
0x756b0000 – 0x75707000     C:\Windows\syswow64\SHLWAPI.dll 
0x7c3c0000 – 0x7c43c000     C:\Windows\system32\MSVCP71.dll 
0x73680000 – 0x73689000     C:\Windows\system32\VERSION.dll 
0x73640000 – 0x7364b000     C:\Windows\system32\profapi.dll 
0x71bb0000 – 0x71bb5000     C:\Windows\System32\wshtcpip.dll 
0x73620000 – 0x7363c000     C:\Windows\system32\IPHLPAPI.DLL 
0x73610000 – 0x73617000     C:\Windows\system32\WINNSI.DLL 
0x71400000 – 0x71406000     C:\Windows\system32\rasadhlp.dll 
0x71420000 – 0x71458000     C:\Windows\System32\fwpuclnt.dll 
0x6d600000 – 0x6d609000     D:\Java\x86\jdk1.6.0_31\jre\bin\management.dll 
0x6d6d0000 – 0x6d6d9000     D:\Java\x86\jdk1.6.0_31\jre\bin\nio.dll 
0x6d850000 – 0x6d858000     D:\Java\x86\jdk1.6.0_31\jre\bin\sunmscapi.dll 
0x75370000 – 0x7548e000     C:\Windows\syswow64\CRYPT32.dll 
0x74fa0000 – 0x74fac000     C:\Windows\syswow64\MSASN1.dll 
0x72f00000 – 0x72f16000     C:\Windows\system32\CRYPTSP.dll 
0x72ec0000 – 0x72efb000     C:\Windows\system32\rsaenh.dll 
0x73650000 – 0x73667000     C:\Windows\system32\USERENV.dll 
0x6d370000 – 0x6d38a000     D:\Java\x86\jdk1.6.0_31\jre\bin\instrument.dll 
0x724e0000 – 0x724ed000     C:\Windows\system32\dhcpcsvc6.DLL 
0x72540000 – 0x72552000     C:\Windows\system32\dhcpcsvc.DLL 
0x6d7a0000 – 0x6d7a6000     D:\Java\x86\jdk1.6.0_31\jre\bin\rmi.dll 
0x76d00000 – 0x76d05000     C:\Windows\system32\PSAPI.DLL 
0x6d0b0000 – 0x6d1fc000     D:\Java\x86\jdk1.6.0_31\jre\bin\awt.dll 
0x72c60000 – 0x72cb1000     C:\Windows\system32\WINSPOOL.DRV 
0x73190000 – 0x7332e000     C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\COMCTL32.dll 
 
VM Arguments: 
jvm_args: -Dcom.apusic.domain.home=D:\AAS8.0\AAS\domains\mydomain -Xms1024m -Xmx1024m -XX:MaxPermSize=256m  
java_command: com.apusic.server.Main -root D:\AAS8.0\AAS 
Launcher Type: SUN_STANDARD 
 
Environment Variables: 
JAVA_HOME=D:\Java\x86\jdk1.6.0_31 
CLASSPATH=D:\AAS8.0\AAS\classes;D:\AAS8.0\AAS\common\javaee.jar;D:\AAS8.0\AAS\common\jsf-api.jar;D:\AAS8.0\AAS\lib\apusic-client.jar;D:\AAS8.0\AAS\lib\apusic-jms.jar;D:\AAS8.0\AAS\lib\apusic-ws.jar;D:\AAS8.0\AAS\lib\apusic.jar;D:\AAS8.0\AAS\lib\bean-validator.jar;D:\AAS8.0\AAS\lib\deploy.jar;D:\AAS8.0\AAS\lib\elite-api.jar;D:\AAS8.0\AAS\lib\elite.jar;D:\AAS8.0\AAS\lib\firststep.jar;D:\AAS8.0\AAS\lib\jasper-jdt.jar;D:\AAS8.0\AAS\lib\mejb.jar;D:\AAS8.0\AAS\lib\operamasks-impl.jar;D:\AAS8.0\AAS\lib\razor.jar;D:\AAS8.0\AAS\lib\ext\activation.jar;D:\AAS8.0\AAS\lib\ext\bcprov-jdk15-138.jar;D:\AAS8.0\AAS\lib\ext\dsn.jar;D:\AAS8.0\AAS\lib\ext\eclipselink.jar;D:\AAS8.0\AAS\lib\ext\jaxb-impl.jar;D:\AAS8.0\AAS\lib\ext\jaxb-xjc.jar;D:\AAS8.0\AAS\lib\ext\jgroups-all.jar;D:\AAS8.0\AAS\lib\ext\jhall.jar;D:\AAS8.0\AAS\lib\ext\jmxremote.jar;D:\AAS8.0\AAS\lib\ext\jmxremote_optional.jar;D:\AAS8.0\AAS\lib\ext\ldapjdk.jar;D:\AAS8.0\AAS\lib\ext\ldapsp.jar;D:\AAS8.0\AAS\lib\ext\mail.jar;D:\AAS8.0\AAS\lib\ext\operamasks-third-party.jar;D:\AAS8.0\AAS\lib\ext\standard.jar;D:\AAS8.0\AAS\lib\ext\toplink-essentials-agent.jar;D:\AAS8.0\AAS\lib\ext\toplink-essentials.jar;D:\AAS8.0\AAS\lib\ext\xmemcached.jar;.;D:\Java\x86\jdk1.6.0_31\lib\tools.jar;D:\Java\x86\jdk1.6.0_31\lib\dt.jar 
PATH=D:\AAS8.0\AAS\bin;D:\Java\x86\jdk1.6.0_31\bin;D:\Java\x86\jdk1.6.0_31\bin;C:\Program Files (x86)\Common Files\NetSarang;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Lenovo\Access Connections\;D:\MySQL\MySQL Server 5.5\bin;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;D:\Program Files (x86)\QuickTime\QTSystem\;d:\SSH Communications Security\SSH Secure Shell 
USERNAME=mortimer 
OS=Windows_NT 
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 42 Stepping 7, GenuineIntel 
 
 
 
—————  S Y S T E M  ————— 
 
OS: Windows 7 , 64 bit Build 7601 Service Pack 1 
 
CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 42 stepping 7, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, ht 
 
Memory: 4k page, physical 8273136k(4724820k free), swap 16544420k(12014064k free) 
 
vm_info: Java HotSpot(TM) Server VM (20.6-b01) for windows-x86 JRE (1.6.0_31-b05), built on Feb  3 2012 18:35:56 by "java_re" with MS VC++ 7.1 (VS2003) 
 
time: Mon Aug 27 15:11:04 2012 
elapsed time: 66 seconds 

#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 678096 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:317), pid=2468, tid=2708
#
# JRE version: 6.0_31-b05
# Java VM: Java HotSpot(TM) Server VM (20.6-b01 mixed mode windows-x86 )

—————  T H R E A D  —————

Current thread (0x05f65c00):  JavaThread "C2 CompilerThread1" daemon [_thread_in_native, id=2708, stack(0x06320000,0x06370000)]

Stack: [0x06320000,0x06370000],  sp=0x0636e594,  free space=313k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)

[error occurred during error reporting (printing native stack), id 0xc0000005]

Current CompileTask:
C2:  66818 1186      com.sun.corba.se.impl.corba.TypeCodeImpl.read_value_body(Lorg/omg/CORBA_2_3/portable/InputStream;)V (1274 bytes)

—————  P R O C E S S  —————

Java Threads: ( => current thread )
  0x08447000 JavaThread "Idle HTTPHandler-4" [_thread_blocked, id=7344, stack(0x0e320000,0x0e370000)]
  0x08446800 JavaThread "Idle HTTPHandler-3" [_thread_blocked, id=4148, stack(0x0e290000,0x0e2e0000)]
  0x08446000 JavaThread "Idle HTTPHandler-2" [_thread_blocked, id=5736, stack(0x0e200000,0x0e250000)]
  0x08445c00 JavaThread "Idle ORBWorker-3" [_thread_blocked, id=6876, stack(0x0c460000,0x0c4b0000)]
  0x08445400 JavaThread "Running ORBWorker-2" [_thread_in_vm, id=6612, stack(0x0c330000,0x0c380000)]
  0x08445000 JavaThread "AS-Monitor Sampling Thread: ThreadMonitor" [_thread_blocked, id=7820, stack(0x0c290000,0x0c2e0000)]
  0x08444800 JavaThread "AS-Monitor Sampling Thread: HttpConnectionMonitor" [_thread_blocked, id=7688, stack(0x0c200000,0x0c250000)]
  0x06fb3c00 JavaThread "AS-Monitor Sampling Thread: DataSourcesMonitor" [_thread_blocked, id=1448, stack(0x0c170000,0x0c1c0000)]
  0x07ffac00 JavaThread "AS-Monitor Sampling Thread: SessionsMonitor" [_thread_blocked, id=6160, stack(0x0c0e0000,0x0c130000)]
  0x07ffa400 JavaThread "AS-Monitor Sampling Thread: JTAMonitor" [_thread_blocked, id=6844, stack(0x0c050000,0x0c0a0000)]
  0x07ffa000 JavaThread "AS-Monitor Sampling Thread: ClassLoadMonitor" [_thread_blocked, id=7148, stack(0x0bfc0000,0x0c010000)]
  0x07ff9800 JavaThread "AS-Monitor Sampling Thread: MemoryMonitor" [_thread_blocked, id=7428, stack(0x0bf30000,0x0bf80000)]
  0x07ff9000 JavaThread "p: default-threadpool; w: Idle" daemon [_thread_blocked, id=4840, stack(0x0b4e0000,0x0b530000)]
  0x07ff8c00 JavaThread "p: default-threadpool; w: Idle" daemon [_thread_blocked, id=6512, stack(0x0b440000,0x0b490000)]
  0x07ff8400 JavaThread "Thread-19" daemon [_thread_blocked, id=7412, stack(0x0b230000,0x0b280000)]
  0x07ff8000 JavaThread "JMX server connection timeout 64" daemon [_thread_blocked, id=2176, stack(0x0b180000,0x0b1d0000)]
  0x07ff7800 JavaThread "p: default-threadpool; w: Idle" daemon [_thread_blocked, id=7128, stack(0x0b010000,0x0b060000)]
  0x07ff7400 JavaThread "Idle ORBWorker-1" [_thread_blocked, id=7976, stack(0x0af60000,0x0afb0000)]
  0x06fb4800 JavaThread "SelectorThread" daemon [_thread_in_native, id=3124, stack(0x0aec0000,0x0af10000)]
  0x06fb4000 JavaThread "SelectorThread" daemon [_thread_in_native, id=2704, stack(0x0ae10000,0x0ae60000)]
  0x06fb3400 JavaThread "pool-2-thread-1" [_thread_blocked, id=8036, stack(0x0a910000,0x0a960000)]
  0x06fb2c00 JavaThread "Idle HTTPHandler-1" [_thread_blocked, id=6600, stack(0x0a7d0000,0x0a820000)]
  0x06fb2800 JavaThread "HttpReader" [_thread_in_native, id=5532, stack(0x0a740000,0x0a790000)]
  0x06fb2000 JavaThread "MuxReader" [_thread_in_native, id=6712, stack(0x0a6b0000,0x0a700000)]
  0x06fb1c00 JavaThread "AutoDeployer" [_thread_blocked, id=6732, stack(0x0a1d0000,0x0a220000)]
  0x06fb1400 JavaThread "MongoCleaner22152612" daemon [_thread_blocked, id=4764, stack(0x0a140000,0x0a190000)]
  0x06fb1000 JavaThread "derby.rawStoreDaemon" daemon [_thread_blocked, id=8008, stack(0x0a0a0000,0x0a0f0000)]
  0x06cfc000 JavaThread "Timer-2" daemon [_thread_blocked, id=6484, stack(0x09fe0000,0x0a030000)]
  0x06cf8000 JavaThread "derby.antiGC" daemon [_thread_blocked, id=3232, stack(0x08fd0000,0x09020000)]
  0x06cfb800 JavaThread "RMI TCP Connection(idle)" daemon [_thread_blocked, id=2936, stack(0x09ba0000,0x09bf0000)]
  0x06cfb400 JavaThread "RMI TCP Connection(4)-192.168.0.70" daemon [_thread_blocked, id=7516, stack(0x095f0000,0x09640000)]
  0x06cfac00 JavaThread "RMI TCP Connection(idle)" daemon [_thread_blocked, id=5808, stack(0x094d0000,0x09520000)]
  0x06cfa800 JavaThread "RMI TCP Connection(2)-192.168.0.70" daemon [_thread_in_native, id=5784, stack(0x09430000,0x09480000)]
  0x06cfa000 JavaThread "JMX server connection timeout 41" daemon [_thread_blocked, id=6264, stack(0x09320000,0x09370000)]
  0x06cf9c00 JavaThread "RMI Scheduler(0)" daemon [_thread_blocked, id=8124, stack(0x09290000,0x092e0000)]
  0x06cf9400 JavaThread "RMI TCP Connection(1)-192.168.0.70" daemon [_thread_in_native, id=8160, stack(0x09200000,0x09250000)]
  0x06cf8800 JavaThread "RMI TCP Accept-0" daemon [_thread_in_native, id=6096, stack(0x091b0000,0x09200000)]
  0x06cf7c00 JavaThread "derby.rawStoreDaemon" daemon [_thread_blocked, id=1388, stack(0x08f40000,0x08f90000)]
  0x06cf7400 JavaThread "Timer-1" daemon [_thread_blocked, id=3912, stack(0x08eb0000,0x08f00000)]
  0x06cf7000 JavaThread "derby.antiGC" daemon [_thread_blocked, id=6244, stack(0x08e20000,0x08e70000)]
  0x06cf6000 JavaThread "Idle JMSHandler-4" [_thread_blocked, id=6420, stack(0x07dc0000,0x07e10000)]
  0x06cf5c00 JavaThread "Idle JMSHandler-3" [_thread_blocked, id=7960, stack(0x07d30000,0x07d80000)]
  0x06cf5400 JavaThread "Idle JMSHandler-2" [_thread_blocked, id=2436, stack(0x07ca0000,0x07cf0000)]
  0x06cf5000 JavaThread "pool-1-thread-5" [_thread_blocked, id=5680, stack(0x07c10000,0x07c60000)]
  0x06cf4800 JavaThread "JMSReader" [_thread_in_native, id=5280, stack(0x07b80000,0x07bd0000)]
  0x06d50000 JavaThread "pool-1-thread-4" [_thread_blocked, id=5472, stack(0x07af0000,0x07b40000)]
  0x06c2bc00 JavaThread "Timer-0" [_thread_blocked, id=5444, stack(0x07a60000,0x07ab0000)]
  0x06c2b800 JavaThread "pool-1-thread-3" [_thread_blocked, id=5296, stack(0x079d0000,0x07a20000)]
  0x06c2b000 JavaThread "Running JMSHandler-1" [_thread_blocked, id=7408, stack(0x07940000,0x07990000)]
  0x06c2ac00 JavaThread "HTTPSessionSwapper" [_thread_blocked, id=6828, stack(0x078b0000,0x07900000)]
  0x06c77c00 JavaThread "pool-1-thread-2" [_thread_blocked, id=3896, stack(0x07820000,0x07870000)]
  0x07271800 JavaThread "Thread-3" [_thread_blocked, id=3180, stack(0x07790000,0x077e0000)]
  0x06d2c400 JavaThread "MuxSecureListener" [_thread_in_native, id=7824, stack(0x076b0000,0x07700000)]
  0x06ca2800 JavaThread "MuxListener" [_thread_in_native, id=8040, stack(0x068d0000,0x06920000)]
  0x06bf5800 JavaThread "pool-1-thread-1" [_thread_blocked, id=6192, stack(0x06840000,0x06890000)]
  0x06bf5400 JavaThread "LogManager" [_thread_blocked, id=1048, stack(0x06740000,0x06790000)]
  0x05f69400 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=6396, stack(0x063b0000,0x06400000)]
=>0x05f65c00 JavaThread "C2 CompilerThread1" daemon [_thread_in_native, id=2708, stack(0x06320000,0x06370000)]
  0x05f3d400 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=4736, stack(0x06290000,0x062e0000)]
  0x05f3ac00 JavaThread "Attach Listener" daemon [_thread_blocked, id=8056, stack(0x06200000,0x06250000)]
  0x05f32000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=6720, stack(0x06170000,0x061c0000)]
  0x027d2c00 JavaThread "Finalizer" daemon [_thread_blocked, id=2296, stack(0x05ee0000,0x05f30000)]
  0x027d1800 JavaThread "Reference Handler" daemon [_thread_blocked, id=4972, stack(0x05e50000,0x05ea0000)]
  0x004db800 JavaThread "main" [_thread_blocked, id=716, stack(0x00430000,0x00480000)]

Other Threads:
  0x027ce800 VMThread [stack: 0x05dc0000,0x05e10000] [id=5688]
  0x05f72400 WatcherThread [stack: 0x06440000,0x06490000] [id=7564]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 PSYoungGen      total 305856K, used 108523K [0x49ac0000, 0x5f010000, 0x5f010000)
  eden space 262208K, 38% used [0x49ac0000,0x4fd23988,0x59ad0000)
  from space 43648K, 17% used [0x5c570000,0x5cd075d8,0x5f010000)
  to   space 43648K, 0% used [0x59ad0000,0x59ad0000,0x5c570000)
 PSOldGen        total 699072K, used 11615K [0x1f010000, 0x49ac0000, 0x49ac0000)
  object space 699072K, 1% used [0x1f010000,0x1fb67c70,0x49ac0000)
 PSPermGen       total 78336K, used 58337K [0x0f010000, 0x13c90000, 0x1f010000)
  object space 78336K, 74% used [0x0f010000,0x12908470,0x13c90000)

Code Cache  [0x027e0000, 0x02b20000, 0x057e0000)
 total_blobs=1388 nmethods=1153 adapters=188 free_code_cache=47006656 largest_free_block=29760

Dynamic libraries:
0x00400000 – 0x00425000  D:\Java\x86\jdk1.6.0_31\bin\java.exe
0x77cf0000 – 0x77e70000  C:\Windows\SysWOW64\ntdll.dll
0x74fb0000 – 0x750c0000  C:\Windows\syswow64\kernel32.dll
0x750c0000 – 0x75106000  C:\Windows\syswow64\KERNELBASE.dll
0x75200000 – 0x752a0000  C:\Windows\syswow64\ADVAPI32.dll
0x76b60000 – 0x76c0c000  C:\Windows\syswow64\msvcrt.dll
0x75690000 – 0x756a9000  C:\Windows\SysWOW64\sechost.dll
0x77200000 – 0x772f0000  C:\Windows\syswow64\RPCRT4.dll
0x74f40000 – 0x74fa0000  C:\Windows\syswow64\SspiCli.dll
0x74f30000 – 0x74f3c000  C:\Windows\syswow64\CRYPTBASE.dll
0x7c340000 – 0x7c396000  D:\Java\x86\jdk1.6.0_31\jre\bin\msvcr71.dll
0x6db90000 – 0x6dfe8000  D:\Java\x86\jdk1.6.0_31\jre\bin\server\jvm.dll
0x766d0000 – 0x767d0000  C:\Windows\syswow64\USER32.dll
0x752a0000 – 0x75330000  C:\Windows\syswow64\GDI32.dll
0x75680000 – 0x7568a000  C:\Windows\syswow64\LPK.dll
0x76d10000 – 0x76dad000  C:\Windows\syswow64\USP10.dll
0x767d0000 – 0x76802000  C:\Windows\syswow64\WINMM.dll
0x76ca0000 – 0x76d00000  C:\Windows\system32\IMM32.DLL
0x755b0000 – 0x7567c000  C:\Windows\syswow64\MSCTF.dll
0x71ad0000 – 0x71b1c000  C:\Windows\system32\apphelp.dll
0x72f80000 – 0x72fb2000  C:\Windows\SysWOW64\nvinit.dll
0x0f000000 – 0x0f006000  C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\_etoured.dll
0x71a90000 – 0x71acc000  C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\nvd3d9wrap.dll
0x75710000 – 0x758ad000  C:\Windows\syswow64\SETUPAPI.dll
0x75330000 – 0x75357000  C:\Windows\syswow64\CFGMGR32.dll
0x758b0000 – 0x7593f000  C:\Windows\syswow64\OLEAUT32.dll
0x76db0000 – 0x76f0c000  C:\Windows\syswow64\ole32.dll
0x76840000 – 0x76852000  C:\Windows\syswow64\DEVOBJ.dll
0x71a50000 – 0x71a8b000  C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\nvdxgiwrap.dll
0x6d870000 – 0x6d87c000  D:\Java\x86\jdk1.6.0_31\jre\bin\verify.dll
0x6d3d0000 – 0x6d3ef000  D:\Java\x86\jdk1.6.0_31\jre\bin\java.dll
0x6d8b0000 – 0x6d8bf000  D:\Java\x86\jdk1.6.0_31\jre\bin\zip.dll
0x6d6b0000 – 0x6d6c3000  D:\Java\x86\jdk1.6.0_31\jre\bin\net.dll
0x76c10000 – 0x76c45000  C:\Windows\syswow64\WS2_32.dll
0x75490000 – 0x75496000  C:\Windows\syswow64\NSI.dll
0x722c0000 – 0x722fc000  C:\Windows\system32\mswsock.dll
0x713f0000 – 0x713f6000  C:\Windows\System32\wship6.dll
0x72510000 – 0x72520000  C:\Windows\system32\NLAapi.dll
0x72500000 – 0x72510000  C:\Windows\system32\napinsp.dll
0x72420000 – 0x72432000  C:\Windows\system32\pnrpnsp.dll
0x72270000 – 0x722b4000  C:\Windows\system32\DNSAPI.dll
0x724f0000 – 0x724f8000  C:\Windows\System32\winrnr.dll
0x003e0000 – 0x003f7000  C:\Program Files (x86)\Common Files\Thunder Network\NetMon\net_monitor2.0.2.7.dll
0x75a80000 – 0x766ca000  C:\Windows\syswow64\SHELL32.dll
0x756b0000 – 0x75707000  C:\Windows\syswow64\SHLWAPI.dll
0x7c3c0000 – 0x7c43c000  C:\Windows\system32\MSVCP71.dll
0x73680000 – 0x73689000  C:\Windows\system32\VERSION.dll
0x73640000 – 0x7364b000  C:\Windows\system32\profapi.dll
0x71bb0000 – 0x71bb5000  C:\Windows\System32\wshtcpip.dll
0x73620000 – 0x7363c000  C:\Windows\system32\IPHLPAPI.DLL
0x73610000 – 0x73617000  C:\Windows\system32\WINNSI.DLL
0x71400000 – 0x71406000  C:\Windows\system32\rasadhlp.dll
0x71420000 – 0x71458000  C:\Windows\System32\fwpuclnt.dll
0x6d600000 – 0x6d609000  D:\Java\x86\jdk1.6.0_31\jre\bin\management.dll
0x6d6d0000 – 0x6d6d9000  D:\Java\x86\jdk1.6.0_31\jre\bin\nio.dll
0x6d850000 – 0x6d858000  D:\Java\x86\jdk1.6.0_31\jre\bin\sunmscapi.dll
0x75370000 – 0x7548e000  C:\Windows\syswow64\CRYPT32.dll
0x74fa0000 – 0x74fac000  C:\Windows\syswow64\MSASN1.dll
0x72f00000 – 0x72f16000  C:\Windows\system32\CRYPTSP.dll
0x72ec0000 – 0x72efb000  C:\Windows\system32\rsaenh.dll
0x73650000 – 0x73667000  C:\Windows\system32\USERENV.dll
0x6d370000 – 0x6d38a000  D:\Java\x86\jdk1.6.0_31\jre\bin\instrument.dll
0x724e0000 – 0x724ed000  C:\Windows\system32\dhcpcsvc6.DLL
0x72540000 – 0x72552000  C:\Windows\system32\dhcpcsvc.DLL
0x6d7a0000 – 0x6d7a6000  D:\Java\x86\jdk1.6.0_31\jre\bin\rmi.dll
0x76d00000 – 0x76d05000  C:\Windows\system32\PSAPI.DLL
0x6d0b0000 – 0x6d1fc000  D:\Java\x86\jdk1.6.0_31\jre\bin\awt.dll
0x72c60000 – 0x72cb1000  C:\Windows\system32\WINSPOOL.DRV
0x73190000 – 0x7332e000  C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\COMCTL32.dll

VM Arguments:
jvm_args: -Dcom.apusic.domain.home=D:\AAS8.0\AAS\domains\mydomain -Xms1024m -Xmx1024m -XX:MaxPermSize=256m
java_command: com.apusic.server.Main -root D:\AAS8.0\AAS
Launcher Type: SUN_STANDARD

Environment Variables:
JAVA_HOME=D:\Java\x86\jdk1.6.0_31
CLASSPATH=D:\AAS8.0\AAS\classes;D:\AAS8.0\AAS\common\javaee.jar;D:\AAS8.0\AAS\common\jsf-api.jar;D:\AAS8.0\AAS\lib\apusic-client.jar;D:\AAS8.0\AAS\lib\apusic-jms.jar;D:\AAS8.0\AAS\lib\apusic-ws.jar;D:\AAS8.0\AAS\lib\apusic.jar;D:\AAS8.0\AAS\lib\bean-validator.jar;D:\AAS8.0\AAS\lib\deploy.jar;D:\AAS8.0\AAS\lib\elite-api.jar;D:\AAS8.0\AAS\lib\elite.jar;D:\AAS8.0\AAS\lib\firststep.jar;D:\AAS8.0\AAS\lib\jasper-jdt.jar;D:\AAS8.0\AAS\lib\mejb.jar;D:\AAS8.0\AAS\lib\operamasks-impl.jar;D:\AAS8.0\AAS\lib\razor.jar;D:\AAS8.0\AAS\lib\ext\activation.jar;D:\AAS8.0\AAS\lib\ext\bcprov-jdk15-138.jar;D:\AAS8.0\AAS\lib\ext\dsn.jar;D:\AAS8.0\AAS\lib\ext\eclipselink.jar;D:\AAS8.0\AAS\lib\ext\jaxb-impl.jar;D:\AAS8.0\AAS\lib\ext\jaxb-xjc.jar;D:\AAS8.0\AAS\lib\ext\jgroups-all.jar;D:\AAS8.0\AAS\lib\ext\jhall.jar;D:\AAS8.0\AAS\lib\ext\jmxremote.jar;D:\AAS8.0\AAS\lib\ext\jmxremote_optional.jar;D:\AAS8.0\AAS\lib\ext\ldapjdk.jar;D:\AAS8.0\AAS\lib\ext\ldapsp.jar;D:\AAS8.0\AAS\lib\ext\mail.jar;D:\AAS8.0\AAS\lib\ext\operamasks-third-party.jar;D:\AAS8.0\AAS\lib\ext\standard.jar;D:\AAS8.0\AAS\lib\ext\toplink-essentials-agent.jar;D:\AAS8.0\AAS\lib\ext\toplink-essentials.jar;D:\AAS8.0\AAS\lib\ext\xmemcached.jar;.;D:\Java\x86\jdk1.6.0_31\lib\tools.jar;D:\Java\x86\jdk1.6.0_31\lib\dt.jar
PATH=D:\AAS8.0\AAS\bin;D:\Java\x86\jdk1.6.0_31\bin;D:\Java\x86\jdk1.6.0_31\bin;C:\Program Files (x86)\Common Files\NetSarang;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Lenovo\Access Connections\;D:\MySQL\MySQL Server 5.5\bin;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;D:\Program Files (x86)\QuickTime\QTSystem\;d:\SSH Communications Security\SSH Secure Shell
USERNAME=mortimer
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 42 Stepping 7, GenuineIntel

 

—————  S Y S T E M  —————

OS: Windows 7 , 64 bit Build 7601 Service Pack 1

CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 42 stepping 7, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, ht

Memory: 4k page, physical 8273136k(4724820k free), swap 16544420k(12014064k free)

vm_info: Java HotSpot(TM) Server VM (20.6-b01) for windows-x86 JRE (1.6.0_31-b05), built on Feb  3 2012 18:35:56 by "java_re" with MS VC++ 7.1 (VS2003)

time: Mon Aug 27 15:11:04 2012
elapsed time: 66 seconds

發生問題以後,再次啟動AS,使用jconsole監控,加os的資源管理器查看,一切看起來都非常正常。單單從錯誤日志來看,是內存不足導致JVM的carsh。

但是,本機有8G內存,運行此應用時,僅僅用瞭不到3G,試著使用-Xmx加大內存,試著提升到1600M,但是,無法啟動,最終定位在1200M,但是,AS依然會在運行一段時間後crash。
接下來就是各種google,有人說這是jdk1.6的bug不過人傢的小版本號是25(甚至還有某些號稱某電商的人,建議回滾至update24版本),我這是31,難道這個bug一直沒有關閉?關於這個問題在StackOverflow有一篇帖子 問題跟我一樣,並且采用瞭各種辦法貌似是最終解決瞭。

樓主在啟動時加上瞭-XX:-DoEscapeAnalysis參數,但是我這依然不可以,這個參數貌似是不再分析可能的溢出,我這隻是將crash的時間稍微延後瞭一些,問題依然沒有解決。

再查看此帖的後面,說是降低-Xmx的大小,而且在jvm的崩潰日志中也提到降低-Xmx/Xms的大小,於是試著降低大小,並且把as啟動時的jvm參數全部去掉,使用默認值。問題竟然解決瞭,從目前來看,as運行瞭半小時依然沒有問題(開始時是1分鐘以內自動crash)。但是,在實際的生產環境中,JVM默認的參數,往往不能滿足需要,因此,就出現一個問題:既然操作系統已經安裝64位,並且JDK有64位版本存在,生產環境下盡量在64位的os下安裝使用64位jdk,從而把性能發揮至最優。

關於為何要降低jvm堆的大小,有以下說明:

 

[plain]
JVM線程堆棧 
 
應用程序中的每個線程都需要內存來存儲器堆棧(用於在調用函數時持有局部變量並維護狀態的內存區域)。每個 Java 線程都需要堆棧空間來運行。 
 
根據實現的不同,Java 線程可以分為本機線程和 Java 堆棧。除瞭堆棧空間,每個線程還需要為線程本地存儲(thread-local storage)和內部數據結構提供一些本機內存。 
 
JVM堆棧大小 
 
-Xss 128k:設置每個線程的堆棧大小。JDK5.0以後每個線程堆 棧大小為1M,以前每個線程堆棧大小為256K。更具應用的線程所需內存大小進行調整。 www.aiwalls.com
 
在相同物理內存下,減小這個值能生成更多的線程。但是操作系統對一 個進程內的線程數還是有限制的,不能無限生成,經驗值在3000~5000左右。 
 
JVM heap與JVM私有內存、JVM線程堆棧大小間的關系及平衡。 
 
線程棧的大小是個雙刃劍,如果設置過小,可能會出現棧溢出,特別是在該線程內有遞歸、大的循環時 
 
時出現溢出的可能性更大,如果該值設置過大,就有影響到創建棧的數量,如果是多線程的應用,就會 
 
出現內存溢出的錯誤. 

發佈留言