Hello, I have been trying to figure out the cause of a memory leak in my
web application that causes "java.lang.OutOfMemoryError: GC overhead
limit exceeded" and "java.lang.OutOfMemoryError: Java heap space" errors.
This happens about once a day after heavy load. I am using dumps from
jmap and jhat to parse the dump.
It seems like there are more instances of
org.apache.tomcat.util.http.ServerCookie than there should be and they
seem to be taking up a fairly big piece of memory. Usually there are
300 or so busy http threads, and there are 299 instances of
org.apache.tomcat.util.http.Cookies, but it looks like there are 4549
instances of ServerCookie, which seems weird to me.
I guess that is around 15 cookies per request. It looks like the
ServerCookie instances are taking up > 100 meg. Maybe this is totally
normal but I'm just starting with what is taking up the biggest chunk of
memory and going from there.
If anyone has any information or advice, I would really appreciate it.
Here is a trace down from the heap histogram. The >>> means I drilled
down into that class.
Heap Histogram
All Classes (excluding platform)
Class Instance Count
Total Size
class [B 56760
614689141 >>>>
class [C 1124519
312509218
class [I 107844
92680628
class [Ljava.util.HashMap$Entry; 40941 26222864
class java.lang.String 965281
19305620
class [Ljava.util.Hashtable$Entry; 57747 7655160
class [Ljava.lang.Object; 79781
7227456
class java.util.HashMap$Entry 244617 6849276
class java.util.Hashtable$Entry 199424
5583872
class [Ljava.lang.String; 57062
5558752
Referrers by Type
Class
Instance Count
org.apache.tomcat.util.buf.ByteChunk 18696 (33%)
(203mb) >>>>
[Ljava.lang.Object; 11986
[[B 9990
java.nio.HeapByteBuffer 6200
com.mysql.jdbc.Buffer 2429
com.mysql.jdbc.Field 2217
org.apache.tomcat.util.buf.MessageBytes 44576 >>>>
org.apache.tomcat.util.http.ServerCookie 22665 >>>>
org.apache.tomcat.util.http.MimeHeaderField 12480
org.apache.coyote.Request 4488
[Lorg.apache.tomcat.util.http.ServerCookie; 4549 >>>>
org.apache.tomcat.util.http.Cookies 299
Thanks again,
--Brian.