Tomcat memory usage grows in IDLE
Asked Answered
I

2

5

I have problem with growing memory consuming on Tomcat. Just after start nothing happens,but if some user login, after this memory usage start growing in Edem. PermGen does not grow, but anyway, it anormal. jvisualvm profiling

My analyze shows that thread RMI TCP Connection produces lot of Object[] char[] and String[] objects. I can not understand what's wrong and where to dig. Who starts this thread, is is postgres connections and what is this?

Inflation answered 31/10, 2014 at 12:35 Comment(0)
E
5

This is normal, and is NOT a memory leak. Objects are created and destroyed constantly by the threads used to manage the application. You see the memory increasing because the JVM garbage collector is not eagerly reclaiming unused memory. This happens periodically (based on previous statistics) or when memory is running low. If it were a real memory leak, you would not see the Eden memory usage drop down to almost zero after a collection. A memory leak is shown as the lowest point (right after a GC) increasing over time.

Eskilstuna answered 31/10, 2014 at 12:52 Comment(8)
I am agree, but eden grows quite fast on local PC without any activity + on production tomcat starts to failInflation
What do you mean production fails to start/ fails periodically? That seems to be a different issue, unless you're getting OutOfMemoryError or the JVM is getting stuck trying to do GC after GC.Eskilstuna
Actually I do not get OOM exception, but on production from time to time tomcat starts to use 99% cpu load and not responsing anymore.Inflation
When your production Tomcat stops responding, you should take a thread dump and examine that. Depending on what JVM you're using, you will also get the memory usage, which might allow you rule out a memory leak.Eskilstuna
I just got stuck on server and got heapdump from it. BUt there is no usefull information =( The biggest one by size: char[] and String[]Inflation
Care to post the thread dump? There's normally something useful there.Eskilstuna
I can not publish heap dump, but Sorting by retained most popular are: HashMap, org.hibernate.persister.entity.SingleTableEntityPersister, org.hibernate.loader.Loader[] What can I find by jvisualvm?Inflation
Yep, I can confirm this is the case. Once your application has to do something, your Eden usage will drop to zero, and used heap will drop as well.Logrolling
F
2

You are observing that you are observing:

The JVM gathers statistical information about itself and sends it to you. This consumes memory and uses the RMI transfer facilities.

What is RMI TCP Accept, Attach Listener, and Signal Dispatcher in Visual VM?

I also don't see a problem with what that image shows. Eden is basically always growing slowly since there is always a bit work that consumes memory.

Once Eden gets collected (~200MB worth towards the end) you can see that most of the memory is completely free and very little (~8MB) ends in the survivor spaces since there are probably still references to these objects. But they don't seem to leave survivor since OldGen is not growing, also the Histogram at the bottom shows that typical survivor objects make it to level 2 and are gone then.

This all looks pretty normal to me.

Frailty answered 31/10, 2014 at 12:41 Comment(5)
thats right, but server do nothing, nobody connect to it and on production it failing periodically.Inflation
Monitor for longer, the image you show is perfectly normal. If there is a memory leak, you will see OldGen (and / or maybe PermGen) growing over time. The JVM will error once OldGen is full and Garbage collection can't free enough. Also see #543479 for a heapdump that should contain the actual problem. And even if your server is idle: the JVM has management tasks like a garbage collection thread that runs regardless so a bit activity is always present.Frailty
I found out PermGen OOM exception on production, great. =(Inflation
Maybe https://mcmap.net/q/497609/-what-to-do-with-tomcat-permgen-space otherwise frankkieviet.blogspot.ca/2006/10/…Frailty
thank you, good article! I think it is not classloader memory leak, because we tried already not redeploy, but restart tomcat with stop/start. Heap shows that where is 70 mb of HashMap and arrays of HashMap.Inflation

© 2022 - 2024 — McMap. All rights reserved.