Skip to content

Clear AspectJExpressionPointcut cache when it is no longer used #12334

@spring-projects-issues

Description

@spring-projects-issues

Jon Seymour opened SPR-7678 and commented

I have been doing a heap dump analysis of a 64bit JVM that uses Java5, Spring and AspectJ point cuts.

I have observed the following:

  • the number of ReflectionWorlds in the JVM is ~= the number of PointCuts declared to Spring (P)
  • the number of World.TypeMap entries (T) is proportional to the number of types reachable from declarations of beans that Spring can instantiate (T)
  • the number of ReferenceType instances in the JVM is ~= k * the number of World.TypeMap entries

In my case, P is 15, k is observed to be 10 and T is around 4,500.

In other words, the JVM contains 15 * 10 * 5,000 ~ 675,000 ReferenceType objects!

Given that the system only has 4,500 types in it, it seems somewhat absurd that there should be 675,000 ReferenceType objects, but this is what the measurements show.

Is it really necessary that AspectJ creates 10 ReferenceType objects per type?

Is it really necessary that each PointCut introduced by Spring has its own ReflectionWorld?

If these two issues could be fixed, the number of ReferenceType objects consumed by this application could be reduced by a factor of 150 which is not an insignificant saving.


Affects: 3.0.5

Attachments:

3 votes, 5 watchers

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions