Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Memory "Leak" with ConcurrentLinkedQueue$Node

I am having an interesting dilemma where I appear to have a memory leak (or growing data structure). I get the typical "raising linearly over time" graph when I analyse my memory usage. Trying to figure out what the cause of the problem is, I did a heap-dump. What I found was that over 50% of memory was being allocated for a ConcurrentLinkedQueue node. The top consumers of memory are, com.singularity.ee.agent.util.ch and java.util.concurrent.ConcurrentLinkedQueue$Node as seen in the picture below.

enter image description here

I dont know what a util.ch is but it appears to be tied to the Node, as each ch has an immediate reference to a node, so no worries focusing on that.

Now trying to find references to the closest GC for a $Node, I get the following:

enter image description here

Whats strange about this is that it does not have a ConcurrentLinkedQueue$Node, or even a ConcurrentLinkedQueue as a parent at all. All references are strange types that I do not understand, kh, uc, z, g, etc. Does anyone know what these types are?

I am trying to find out what exactly is causing the problem, but I cant seam to find how these nodes are even being created/saved.

Here is the kicker: I do not use the ConcurrentLinkedQueue anywhere in my code. I do use a ConcurrentHashMap, but there are not very many HashMap$Node's so that shouldnt be the issue.

Does anyone have any ideas as to how these nodes are being created or why I have so many instances of them?

To answer dependency questions: I am running tomcat 6, java 6, Java Spring.

like image 874
Nick Humrich Avatar asked Apr 24 '14 18:04

Nick Humrich


People also ask

Can Java expose a memory leak?

Yes, Memory Leak in java is bad because it blocks the memory resources with objects that are not useful but still referenced.

How does Tomcat detect memory leaks in Java?

Go into the heap dump settings for your server Right-click on Tomcat from the sidebar on the left-hand side then select 'Heap Dump'. Figure 2: Heap Dump: Click on the 'OQL Console' button.


1 Answers

Turns out I had some proprietary code from AppDynamics causing this issue. I opened a ticket with them and they fixed the issue in their next release. Thank you for all the help though!

like image 164
Nick Humrich Avatar answered Sep 27 '22 17:09

Nick Humrich