开发者

Detecting Memory Leak in a web application

开发者 https://www.devze.com 2023-03-22 01:11 出处:网络
We have a web application written in gwt and deployed in tomcat. The tomcat crashes on outofmemoryexception, so i am trying to look for memory leaks using Jprofiler, jmap/jhat utility and so on.

We have a web application written in gwt and deployed in tomcat. The tomcat crashes on outofmemoryexception, so i am trying to look for memory leaks using Jprofiler, jmap/jhat utility and so on.

Here are the issues i see and appreciate the expert's help in tracking down the issue.

I have configured tomcat to run with -Xmx1600m -Xms1024m and enabled gc logging. When i see the gc log after running the application for few hours, i see the following,

9850.373: [GC [PSYoungGen: 301459K->10630K(341504K)] 943137K->663019K(1269952K), 0.1711120 secs] [Times: user=0.32 sys=0.02, real=0.17 secs]
9864.412: [GC [PSYoungGen: 320588K->14287K(341376K)] 972976K->668772K(1269824K), 0.1604710 secs] [Times: user=0.24 sys=0.00, real=0.16 secs]
9874.808: [GC [PSYoungGen: 324431K->7800K(377792K)] 978916K->666111K(1306240K), 0.1253720 secs] [Times: user=0.21 sys=0.04, real=0.12 secs]
9884.888: [GC [PSYoungGen: 355320K->7639K(377920K)] 1013631K->670793K(1306368K), 0.1563460 secs] [Times: user=0.23 sys=0.01, real=0.15 secs]
9897.209: [GC [PSYoungGen: 355159K->9687K(423552K)] 1018313K->676330K(1352000K), 0.1368880 secs] [Times: user=0.22 sys=0.05, real=0.14 secs]
9913.372: [GC [PSYoungGen: 403927K->5599K(424000K)] 1070570K->675351K(1352448K), 0.1599430 secs] [Times: user=0.21 sys=0.02, real=0.16 secs]
9999.866: [GC [PSYoungGen: 399839K->6655K(468480K)] 1069591K->678050K(1396928K), 0.2453910 secs] [Times: user=0.37 sys=0.03, real=0.24 secs]
10104.177: [GC [PSYoungGen: 449919K->10830K(472576K)] 1121314K->688787K(1401024K), 0.1271810 secs] [Times: user=0.20 sys=0.03, real=0.12 secs]
10114.859: [GC [PSYoungGen: 454094K->7316K(514240K)] 1132051K->694401K(1442688K), 0.1046640 secs] [Times: user=0.15 sys=0.05, real=0.10 secs]
10127.079: [GC [PSYoungGen: 496084K->6783K(516160K)] 1183169K->699705K(1444608K), 0.1004840 secs] [Times: user=0.17 sys=0.03, real=0.10 secs]
10136.380: [GC [PSYoungGen: 495551K->8800K(516096K)] 1188473K->707881K(1444544K), 0.1615950 secs] [Times: user=0.28 sys=0.04, real=0.16 secs]
10151.757: [GC [PSYoungGen: 500704K->13808K(517696K)] 1199785K->716602K(1446144K), 0.2068230 secs] [Times: user=0.32 sys=0.09, real=0.20 secs]
10184.481: [GC [PSYoungGen: 505712K->4543K(519488K)] 1208506K->开发者_Go百科;716201K(1447936K), 0.2158960 secs] [Times: user=0.32 sys=0.05, real=0.22 secs]
10206.485: [GC [PSYoungGen: 499647K->12190K(520192K)] 1211305K->728137K(1448640K), 0.2251280 secs]

My understanding from the gc.log is the following,

Young generation is using 12190K after Garbage collection. Old Generation is using 728137K after Garbage collection.

So in total the application is using 740M. Am i right in my understanding?

If not, what is right interpretation of this log file?

If yes, i have also looked at the system resource usage using htop ( am running it on linux ) which is showing the tomcat process is using 1419M.

Why is the difference in the memory usage?

Appreciate you help! Thanks.


There was a memory leak in the GWT Requestfactory which is fixed in 2.4. I just upgraded to that and everything works great.

0

精彩评论

暂无评论...
验证码 换一张
取 消