views:

306

answers:

3

We have production system going into infinite loop of full gc and memory drops form 8 gigs to like 1 MB in just 2 minutes.

After taking heap dump it tells me there an is an array of java.lang.Object ([Ljava.lang.Object) with millions of java.lang.String objects having same String taking 99% of heap.

But it doesn't tell me which class is referencing to this array so that I can fix it in the code.

I took the heap dump using jmap tool on JDK 6 and used JProfiler, NetBeans, SAP Memory Analyzer and IBM Memory Analyzer but none of those tell me what is causing this huge array of objects?? ... like what class is referencing to it or contains it.

Do I have to take a different dump with different config in order to get that info? ... Or anything else that can help me find out the culprit class causing this ... it will help a lot.

+2  A: 

I've used SAP Memory Analyser in the past and it's a really great tool to find "Greedy Memory Pigs".

Maybe the following presentation can help: Effective Java Heap Memory Analysis on Enterprise-Scale.

Pascal Thivent
I used YourKit and attached it to one of the production nodes and was able to get complete heap dump with references. Thx for suggestion.
Adnan Memon
A: 

did you tried to simply grep this string through sources and classes ?

kriss
Yep .. but its some input value being passed.
Adnan Memon
+1  A: 

I've used the Eclipse Memory Analyzer before to find problems like this. Usually when it's something straightforward it's fairly easy to find the culprit, but it takes some getting used to the terms. Without the actual dump in hand I can't tell you what might be causing this problem. Perhaps you should look at what this string actually contains, where is it coming from?

wds