1,weblogic8.1默認是不能運行在jdk5和jdk6上的,原因是weblogic8的mbean為1.0版本,而jdk5和jdk6自帶的mbean版本要高(為1.1?)
?
? 可以在環境變量里配置一個參數,設置mbean=1.0,然后weblogic8.1就能運行在jdk5和jdk6上了,但這樣據說會產生其他問題。參見
?
2,如何分析MAT里那個leak餅圖?
? 那個餅圖分為好幾塊,除了Remainder外,其他好幾塊的名字都是以Problem Suspect開始的,看樣子內存泄漏不可能發生在Remainder
3,
有人說
如果98%的時間是用于GC且可用的 Heap size 不足2%,才會產生內存溢出?
4,如何在jdk6配置內存溢出時是否產生dump文件
? 可以在jdk6的jconsole的MBean的com.sun.management的HotSpotDiagnostic MBeanHotSpotDiagnostic MBean的第3個調用里,
? 設置p0為HeapDumpOnOutOfMemoryError,p1為true,然后點擊setVMOption按鈕。
?? 則內存溢出時會自動創建一個java_pid<pid>.hprof的堆dump(轉儲)文件,默認存放工作空間下(例如tomcat的bin目錄)
? ?
?? 先把tomcat的內存設置得很小,再跑應用,后臺很快就報以下錯誤:
java.lang.OutOfMemoryError: Java heap space
Dumping heap to java_pid5736.hprof ...
Heap dump file created [87840650 bytes in 4.488 secs]
2009-2-4 19:17:59 org.apache.tomcat.util.threads.ThreadPool$ControlRunnable run
嚴重: Caught exception (java.lang.OutOfMemoryError: Java heap space) executing org.apache.tomcat.util.net.TcpWorkerThread@a77785, terminating thread
2009-2-4 19:18:02 org.apache.tomcat.util.net.TcpWorkerThread runIt
嚴重: Unexpected error
java.lang.OutOfMemoryError: Java heap space
2009-2-4 19:18:04 org.apache.tomcat.util.threads.ThreadPool$ControlRunnable run
嚴重: Caught exception (java.lang.OutOfMemoryError: Java heap space) executing org.apache.tomcat.util.net.TcpWorkerThread@a77785, terminating thread
Exception in thread "DefaultQuartzScheduler_QuartzSchedulerThread" java.lang.OutOfMemoryError: Java heap space
2009-2-4 19:18:05 org.apache.coyote.http11.Http11Processor process
嚴重: Error processing request
java.lang.OutOfMemoryError: Java heap space
2009-2-4 19:18:13 org.apache.coyote.http11.Http11Processor process
嚴重: Error finishing response
java.lang.OutOfMemoryError: Java heap space
Hibernate: select......這里它抽空還執行了一條sql
.........略.............................
Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Timer-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError: Java heap space
Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError: Java heap space
.........略.............................
?在輸出錯誤日志的過程中,不知何故還會在eclipse的debug里不停的調用java.util.concurrent.ThreadPoolExecutor
5,內存溢出時自動生成的dump文件和未溢出時自己用jmap導出的dump文件的leak餅圖有很大區別,我感覺前者的分析要有用一些。具體區別:
? (1)后者有org.apache.catalina.loader.WebappClassLoader和ZipFileIndex,而前者沒有
? (2)兩者都有org.hibernate.impl.SessionFactoryImpl
? (3)前者有如下的關鍵信息:
8,980 instances of "java.lang.Class", loaded by "<system class
loader>" occupy 8,208,768 (12.43%) bytes.
Biggest instances:
class org.springframework.beans.CachedIntrospectionResults @
0x735f808?-?2,218,536 (3.36%) bytes.
These instances are referenced from one instance of
"java.lang.Thread", loaded by "<system class loader>"6,一個疑問,為何無人訪問時Tomcat的內存圖是鋸齒形的
7,我配置了-XX:+HeapDumpOnCtrlBreak,用的jdk1.5.0_14
結果Ctrl+Break 時報
Unable to create java_pid3072.hprof.m27.10/05/07M20: No such file or directory
在
這里 找到了原因,是jdk的一個bug(
bug id:6454676),This problem has been fixed in 1.4.2_18 and 5.0u17
8,前兩個1g的頂峰處,是tomcat自己進行的gc。后面的幾個是我自己手動gc的

9,
7,002 instances of "java.lang.Class", loaded by "<system class
loader>" occupy 12,359,912 (11.20%) bytes.
Biggest instances:
class sun.rmi.server.UnicastServerRef @ 0x51b16a48?-?4,447,432 (4.03%)
bytes.
class sun.rmi.transport.ObjectTable @ 0x51b40330?-?3,491,160 (3.16%) bytes 問題