New inspectors [message #7161] |
Wed, 19 November 2008 14:42  |
Eclipse User |
|
|
|
Originally posted by: cgrinds.us.ibm.com
In the work I do I've found these 2 inspectors useful.
1) Find strings that retain wasteful char arrays.
This helps find the common problem of a string holding onto a larger than
necessary char[] due to substring(), XML, regex, etc.
In one of my recent heaps this inspector found 16,546 strings backed by a
larger than necessary char[]. For example, the largest "wasted" String has
a length of 251, while it retains a char[] of length 25,546 - and it's the
only reference! That's quite a waste that's easy to fix.
2) Find primitive arrays with a constant value
This started with a more specific inspector that found SWT image(data)s
that were blank. Someone was create lots of images for a cache but never
actually using/drawing into them so they just wasted Java heap. I realized
that the specific image inspector can be extrapolated into a general array
constant value inspector.
If I run this inspector across a recent heap I see 1.3MB wasted by the top
8 offenders. For example someone created a byte[] of size 880,256 but every
entry of that array has the same value.
If you're interested in any of these, let me know,
Chris
--
Chris Grindstaff
cgrinds@us.ibm.com
|
|
|
|
|
Re: New inspectors [message #7635 is a reply to message #7282] |
Thu, 20 November 2008 08:17  |
Eclipse User |
|
|
|
Originally posted by: cgrinds.us.ibm.com
andreas.buchen@sap.com (Andreas Buchen) wrote in
news:ea30fd2f27e9b68eccdb500ca1731968$1@www.eclipse.org:
> Hi Chris,
>
> I'd love to get my hands on those two inspections. The Eclipse way is
> to create a bugzilla entry and attach the patch / files. This way it
> shows up in the IP log and the list of contributions.
>
> It will be interesting to run the "constant values in primitive
> arrays" query on our heap dumps. I haven't look at it that way yet.
>
Hi Andreas,
As you said, I'll attach to a bugzilla entry.
-Chris
--
Chris Grindstaff
cgrinds@us.ibm.com
|
|
|
Powered by
FUDForum. Page generated in 0.03812 seconds