tags:

views:

261

answers:

1

I am trying to reduce the memory footprint of my application. JVisualVM heap dumps report that the objects taking up the most space are:

  • char[]
  • byte[]
  • int[]

Which isn't particularly helpful. How can I track these objects back to the parent classes that are holding them?

Thanks

+2  A: 

Those primitive arrays are likely to be the internal state of things like String, which keeps its state in a char[]. A good profiler will understand this, and will have the notion of "retained size", which describes the size of objects including the size of their sub-objects. This would indicate that String was taking up the space, not char[].

However, I see no mentioned of "retained size" in VisualVM. It doesn't seem to have the proper profiling capabilities of the commercial alternatives.

To see what I'm talking about, try downloading an evaluation of YourKit, and connect that to your app. It's a lot more complex than VisualVM, but it can give you the retained size of the heap objects, and it's quite illuminating. It will also show you what is referencing each of the objects on the heap, so you can trace leaks.

skaffman
Thanks, that sounds like a better option...
MalcomTucker