I am using a bunch of ConcurrentLinkedQueue
s in my application and the GC overhead is huge. How do I check if the ConcurrentLinkedQueue
is the culprit? Is there a standard way in Java to profile these data structures for memory allocation/deallocation?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Try using VisualVM, the official(?) java profiler. Play around with that for a little bit. You can analyze the processes AND the memory of any Java program you're running.
One way to do it is to write a simple test program and run it with the
-verbose:gc
JVM option. For example, the code:Produces the output:
Now if you want to know exactly who is the culprit you can use a profiling tool. I wrote this memory sampler that you can plug in your code to quickly find out in what source code line the instances are being created. So you do:
And when you run you get:
From where you can see that line 327 of
ConcurrentLinkedQueue
is leaking instances for the GC, in other words, it is not pooling them: