Thursday 15 March 2012

java - in VisualVM/OQL how can I get the total size of all instances of objects from a certain package -


I am using VisualVm for a web application profile running in Tomcat. Tomcat is crashing out of memory errors, so I am trying to figure out what this is in my application. When I run MemoryViewer from VisualVm, it seems that the majority of the memory is raised by string / four [], but as long as I can not understand the high level containers of those stars which makes me a little less good In the research I have found Ocul and rsizeof () , so I can do my.package.class o for example SELECT rsizeof (o) for example but not me Know the class I want, so I really I would like to do something like SELECT it.name, rsizeof (o) filter for example (heap.classes), "/my.package./(it.name)"); Instead it does not work.

So what will happen to the OQL? Ideally, I would like to limit to the top 10 or so big, and I would like to be sorted by size.

I'm not sure I fully understand but ... < P> OQL uses a Javascript based expression language, so that you can use the following statement, it will find all the items that are inside java.util. I Regex package (recursively) The sum of the size, it will return a single number:

  sum (filters (heap.objects), "/^java.util Regex./ (slassof (it) .name)"), 'Rsizeof (it)')   

It will take only one time, I only have small piles Tested on the same. Think ^ at the beginning of the package name.

No comments:

Post a Comment