Bug 303758 - [ltw][memory][perf] Empty array instances should be merged
Summary: [ltw][memory][perf] Empty array instances should be merged
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: LTWeaving (show other bugs)
Version: 1.6.8   Edit
Hardware: PC Windows XP
: P2 enhancement (vote)
Target Milestone: 1.6.9M1   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-24 09:21 EST by Neale Upstone CLA
Modified: 2010-04-16 13:10 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Neale Upstone CLA 2010-02-24 09:21:40 EST
Build Identifier: 1.6.8

Analysing a heap dump of our webapps running under tcServer/Insight combo, I discovered that the AspectJ weaver is the biggest sinner for creating empty array references.

This could be eliminated by replacing instances of:
 blah = new ReferenceType[0]; 
with
 blah = EMPTY_REFERENCE_TYPE_ARRAY;
which is defined as 
 private static final ReferenceType[] EMPTY_REFERENCE_TYPE_ARRAY = new ReferenceType[0];

Guilty classes include:
- BoundedReferenceType (new ReerenceType[0])
- Pointcut (new String[0] - x2)
- BcelMethod (genericParameterTypes = new UnresolvedType[paramTypeSigs.length] - often zero)
- GenericSignature$ClassTypeSignature (new FormalTypeParameter[0] and new ClassTypeSignature[0])
- ExposedState (when ctor calls this(0) -> new Var[0] & new boolean[0])

There's a number more, but the above are those with the most instances


Reproducible: Always
Comment 1 Andrew Clement CLA 2010-02-24 13:36:00 EST
all fixed.

Are you really on 1.6.7?  If so I advise moving to 1.6.8 - 1.6.7 has some nasty issues that forced me to quickly release 1.6.8.
Comment 2 Neale Upstone CLA 2010-02-24 16:07:11 EST
Actually on 1.6.8, but for some reason, I was looking at the 1.6.7. source code, so stuck that in in a moment of paranoia.  Have changed it back just for accuracy.