Memory leak in a Java web application

后端 未结 8 1775
借酒劲吻你
借酒劲吻你 2021-01-31 19:24

I have a Java web application running on Tomcat 7 that appears to have a memory leak. The average memory usage of the application increases linearly over time when under load (d

8条回答
  •  北荒
    北荒 (楼主)
    2021-01-31 20:02

    I just encountered the same problem in a totally different application, so tomcat7 is probably not to blame. Memory Analyzer shows 10M unreachable String instances in the process (which has been running for about 2 months), and most/all of them have values that relate to Garbage Collection (e.g., "Allocation Failure", "end of minor GC")

    Memory Analyzer

    Memory Analyzer

    Full GC is now running every 2s but those Strings don't get collected. My guess is that we've hit a bug in the GC code. We use the following java version:

    $ java -version
    java version "1.7.0_06"
    Java(TM) SE Runtime Environment (build 1.7.0_06-b24)
    Java HotSpot(TM) 64-Bit Server VM (build 23.2-b09, mixed mode)
    

    and the following VM parameters:

    -Xms256m -Xmx768m -server -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC 
    -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:NewSize=32m -XX:MaxNewSize=64m
    -XX:SurvivorRatio=8 -verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails 
    -Xloggc:/path/to/file
    

提交回复
热议问题