1

I have a network server app that receives messages in an in-memory queue that are first received on a tcp socket. The messages are then processed and supposedly discarded.

The queue (just a java.util.concurrent.ArrayBlockingQueue) is consistently in a 1 to 2 message size: there is no backup or reference holding there.

Otherwise - there are no in-memory maps, lists, buffers, etc of the messages: they are processed then discarded.So it is unclear to me where to look.

here is a glimpse of the retained memory from the jvisualvm: we can see that 96% of the heap memory is within these byte[] arrays. So .. fix that and the app should be flying again.

enter image description here

Given I have pored through the code - does jvisualvm have a means to "drill down" on those byte arrays to see who is holding references to them?

**Update: from suggestion by @VinceEmigh here is the "Record Allocation stack traces" location:

enter image description here

WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560
  • VisualVM has a "Show allocation stack trace" feature. Sadly, I [couldn't get the dang thing to work](https://stackoverflow.com/questions/34052961/prevent-program-from-crashing-when-showing-allocation-stack-traces).. – Vince Aug 30 '17 at 03:56
  • Hi Vince - thanks - where is this `show allocation stack trace` feature? – WestCoastProjects Aug 30 '17 at 04:00
  • Go to the profiler tab and run the memory profiler. When you see the type, right click it and you should see "*Take snapshot and show allocation stack trace*" (may need to enable it via options, don't remember - been using JMC ever since). Check out my post for a GIF showing how to do it. If it's an option, I *highly* recommend using JMC – Vince Aug 30 '17 at 04:09

0 Answers0