Tomcat中的記憶體洩漏問題

2021-06-01 19:49:20 字數 1557 閱讀 5303

停止tomcat服務的時候,log裡面報了不少的記憶體錯誤資訊。經查詢是tomcat6.0.24以後會檢測到的問題。

leak cause

detected by tomcat

fixed by tomcat

possible enhancements

custom threadlocal class

>=6.0.24

>= 7.0.6

>=6.0.24

>= 7.0.6 no

>= 7.0.6

threadlocal pseudo-leak

>=6.0.24

>= 7.0.6

>=6.0.24

in 6.0.24-6.0.26 timerthread are stopped but it may lead to problems. optional from 6.0.27 with the clearreferencesstoptimerthreads flag. other threads may be stopped with the clearreferencesstopthreads flag, but it's unsafe.

contextclassloader / threads spawned by classes loaded by the common classloader

>=6.0.24

in 6.0.24-6.0.26 timerthread are stopped but it may lead to problems. optional from 6.0.27 with the clearreferencesstoptimerthreads flag. other threads may be stopped with the clearreferencesstopthreads flag, but it's unsafe.

fix the offending code (set the correct ccl when spawning the thread)

contextclassloader / threads spawned by jre classes

no >=6.0.24 pre-spawns some known offenders

static class variables

no > 6.0.? . disabled by default with tomcat 7

logfactory

> 6.0.?

jdbc driver registration

> 6.0.?

> 6.0.?

rmi target

> 6.0.?

還沒公升級的情況下,比如threadlocal的記憶體洩漏問題,tomca7中是用threadlocalleakpreventionlistener來解決的。

而tomcat6.0.24以後可以用context#clearreferencesthreadlocals=true來解決。

記憶體洩漏問題

這個函式動態地分配乙個整數,但從未使用刪除釋放它。因為指標和普通變數遵循相同的規則,函式結束時,pnvalue會超出範圍。因為pnvalue是唯一的變數的位址動態分配的整數,pnvalue摧毀時不再有動態分配的記憶體引用。這就是所謂的記憶體洩漏。因此,動態分配的整數不能被刪除,從而不能重新分配或重用...

PHPExcel 記憶體洩漏問題

網上關於記憶體洩露的問題大都是再說匯出的時候,可這次我遇到的偏偏是匯入的時候。當然,只是針對excel2007格式的文件。我測試過,乙個大概31列 500行的文件,實行匯入之後,php會報如下錯誤 fatal error allowed memory size of 209715200 bytes ...

解決記憶體洩漏問題

編譯 執行下列程式後。從輸出結果發現沒有呼叫 class y 的析構函式,出現了記憶體洩漏。請嘗試修改class x類的定 決這個記憶體洩露問題。並提交定義class x類的 class x x private int p include using namespace std 你提交的 將嵌入到這...