java JVM 記憶體溢位 64位JDK
新產品釋出,拿來試用。由於本機是win7_x64,但是為方便工作,機器安裝了從32位的JDK1.5一直到64位的JDK1.6的4個JDK。為保證執行時能與大多數人的執行狀況相同,依然採用了32位的jdk1.6來執行產品。
結果,我第一次碰到應用伺服器剛起來就crash的問題。
生成的JVM的錯誤日誌如下:
# # 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。
啟動引數:-server -Xms1024M -Xmx1024m -XX:MaxPermSize=128m
但是,本機有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引數全部去掉,使用預設值。問題竟然解決了(但是,根據官方說明,-Xmx的大小預設應該是實體記憶體的1/4,在我這也就是2g,這個值比我設定的引數要大,只是指定之後就出問題),從目前來看,as運行了半小時依然沒有問題(開始時是1分鐘以內自動crash)。但是,在實際的生產環境中,JVM預設的引數,往往不能滿足需要,因此,就出現一個問題:既然作業系統已經安裝64位,並且JDK有64位版本存在,生產環境下儘量在64位的os下安裝使用64位jdk,從而把效能發揮至最優。
關於為何要降低jvm堆的大小,有以下說明:
JVM執行緒堆疊
應用<span class="wp_keywordlink" style="margin: 0px; padding: 0px; border: 0px; background-color: transparent;"><a target=_blank href="http://www.xuebuyuan.com/" title="程式" target="_blank" style="text-decoration: none; color: rgb(1, 150, 227);">程式</a></span>中的每個執行緒都需要記憶體來儲存器堆疊(用於在呼叫函式時持有區域性變數並維護狀態的記憶體區域)。每個 Java 執行緒都需要堆疊空間來執行。
根據實現的不同,Java 執行緒可以分為本機執行緒和 Java 堆疊。除了堆疊空間,每個執行緒還需要為執行緒本地儲存(thread-local storage)和內部資料結構提供一些本機記憶體。
JVM堆疊大小
-Xss 128k:設定每個執行緒的堆疊大小。JDK5.0以後每個執行緒堆 棧大小為1M,以前每個執行緒堆疊大小為256K。根據應用的執行緒所需記憶體大小進行調整。
在相同實體記憶體下,減小這個值能生成更多的執行緒。但是作業系統對一個程序內的執行緒數還是有限制的,不能無限生成,經驗值在3000~5000左右。
JVM heap與JVM私有記憶體、JVM執行緒堆疊大小間的關係及平衡。
執行緒棧的大小是個雙刃劍,如果設定過小,可能會出現棧溢位,特別是在該執行緒內有遞迴、大的迴圈時出現溢位的可能性更大,如果該值設定過大,就又影響到建立棧的數量,如果是多執行緒的應用,就會出現記憶體溢位的錯誤.
轉載自: http://www.xuebuyuan.com/951797.html
相關推薦
java JVM 記憶體溢位 64位JDK
新產品釋出,拿來試用。由於本機是win7_x64,但是為方便工作,機器安裝了從32位的JDK1.5一直到64位的JDK1.6的4個JDK。為保證執行時能與大多數人的執行狀況相同,依然採用了32位的jdk1.6來執行產品。 結果,我第一次碰到應用伺服器剛起來就crash的
分享一次解決線上java應用導致JVM記憶體溢位(OOM)的問題
某個線上的應用執行幾天後,總是出現卡死甚至出現OOM的情況。 注:文中圖片可能與描述不符,僅作為演示! 通過Linux的top命令檢視cpu佔比 首先通過top命令檢視,發現某個java程式佔用了較高記憶體: JDK的jps命令確定是哪個j
JVM之java堆記憶體溢位
Java堆用於儲存物件例項,只要不斷的建立物件,並且保證GC來不及清理java物件,那麼在物件數量達到最大堆的容量後就會產生堆記憶體溢位(堆記憶體大小可以通過 -Xms20M -Xmx20M 來設定,最大堆和最小堆設定的一樣,可避免堆自動擴充套件)
jvm記憶體溢位之jdk命令
jps 檢視java應用pid jps -l 列出應用pid 及jar包完整名稱。 jps -v 列表應用pid 及jvm引數。 jmap 獲取記憶體快照 jmap -histo:live pid檢視記憶體中物件例項的數量及佔據記憶體大小並排序 jmap -dump:for
Java VisualVM分析JVM記憶體溢位
我們經常需要對我們的開發的軟體做各種測試, 軟體對系統資源的使用情況更是不可少, 目前有多個監控工具, 相比JProfiler對系統資源尤其是記憶體的消耗是非常龐大,JDK1.6開始自帶的VisualVM就是不錯的監控工具. 這個工具就在JAVA_HOME\bin\目錄下的jvisualvm.exe, 雙擊
jvm 記憶體溢位 在myeclipse中加大tomcat的jvm記憶體 java.lang.OutOfMemoryError: PermGen space
使用myeclipse啟動兩個SSH2的部署在tomcat6下的專案 報出java.lang.OutOfMemoryError: PermGen space 解決辦法: 在myeclipse中加大jv
32位/64位系統,jdk32位,64位,32/64位jdk編譯出來的class和eclipse 32位和64位
首先關於32位/64位系統,jdk32位,64位,32/64位jdk編譯出來的class和eclipse 32位和64位的一些對應關係做些說明。 1.32位作業系統不可以裝64位jdk,64位作業系統一般都可以安裝32位jdk,64位jdk是完美髮揮效能的。 2.64位eclipse只能在6
JVM——記憶體溢位和記憶體洩漏的區別
今日本帥博主在研究JVM,今天我們就來遊走於記憶體溢位與記憶體洩漏之間,且看看它們是個啥,且又有啥子區別。 1.記憶體溢位和記憶體洩漏是啥 記憶體溢位 out of memory,是指程式在申請記憶體時,沒有足夠的記憶體空間供其使用,出現out of memory;比如申請了一個int
生產環境jvm記憶體溢位問題處理OutOfMemoryError
生產環境jvm記憶體溢位問題處理OutOfMemoryError 問題描述 服務正常部署執行後,前端介面偶爾出現請求無響應情況,頁面出現持續性卡頓。伺服器日誌報下面這個異常: Exception: java.lang.OutOfMemoryError thrown
Java的記憶體溢位與記憶體洩漏
記憶體溢位是啥?記憶體洩漏是啥?它們兩個有關係嗎?讓我們帶著上面的問題來看本篇文章 ·························································································
Linux環境CentOS6.6安裝64位JDK,mysql ,Tomcat9.0.10
宣告使用的 CentOS6.6 版本,安裝64位 jdk 8,Tomcat 9.0.10 ,Mysql 8 ; 首先使用 fileZille 在 usr/local/src/ 目錄建立java ,
【Java執行緒】Java JVM 記憶體模型總結
Java的併發採用的是共享記憶體模型(而非訊息傳遞模型),執行緒之間共享程式的公共狀態,執行緒之間通過寫-讀記憶體中的公共狀態來隱式進行通訊。多個執行緒之間是不能直接傳遞資料互動的,它們之間的互動只能通過共享變數來實現 同步是顯式進行的。程式設計師必須顯式指定某個方法或某段
Java JVM 記憶體解析
文章目錄 Java JVM 記憶體解析 1、最大可用記憶體 -Xmx 2、虛擬機器中可用記憶體量 3、虛擬機器總記憶體量 4、虛擬機器當前實際可用記憶體
linux伺服器部署環境(阿里雲 centos7.4 64位+ jdk+tomcat+mysql安裝)
1.1 準備階段 1、修改 vim 讓文字編輯器顯示行號:vim /etc/vimrc 在第一行插入:set number 然後:wq儲
jvm 記憶體溢位的多種原因及優化方法
讓我們看一下我們日常在開發過程中接觸記憶體溢位的異常: Exception in thread "main" [Full GCjava.lang.OutOfMemoryError: Java heap space at java.util.Ar
Spark任務提交 yarn-cluster模式 解決jvm記憶體溢位問題 以及簡單概述jdk7方法區和jdk8元空間
yarn-cluster 提價任務流程 1、提交方式 ./spark-submit --master yarn --deploy-mode cluster --class org.apache.spark.examples.SparkPi ../lib/spark-exampl
java常見記憶體溢位情形
虛擬機器棧溢位(如果虛擬機器在擴充套件時無法申請到足夠的記憶體空間將丟擲OutOfMemoryError)package com.jvm.memory; import java.util.ArrayList; import java.util.List; public
死磕JVM-如何構造JVM記憶體溢位和棧溢位
為什麼要寫這個題目?我記得我在面試阿里的時候面試官問了我這個問題,當時沒能答得很好,只說了些概念的東西,很是心虛,於是下定決心要把這個問題搞懂,現在終於把這個問題懟清楚了,分享給大家,希望你們以後面試問到這種問題能有所準備。 Java虛擬機器中描述了兩種異常: 1、如果執
Tomcat中JVM記憶體溢位及合理配置
Tomcat本身不能直接在計算機上執行,需要依賴於硬體基礎之上的作業系統和一個Java虛擬機器。Tomcat的記憶體溢位本質就是JVM記憶體溢位,所以在本文開始時,應該先對Java JVM有關記憶體方面的知識進行詳細介紹。 一、Java JVM記憶體介紹 JVM管理兩種
Java服務記憶體溢位問題解決和總結
最近,公司測試環境服務發現一個問題:一個介面服務,合作方再調介面時,經常會出現連線超時異常(connection reset by peer),緊接著看到服務記憶體100%,加記憶體也沒用,不管加多少還是會緩慢升至100%。如下圖: 通過各位大神的指點迷津,大概定位到以