Skip to content

Spel Expressions leaks classes [SPR-15460] #20020

Closed
@spring-projects-issues

Description

@spring-projects-issues

Andrew Rowbottom opened SPR-15460 and commented

SpelCompiler / SpelExpression can leak classes when a compiled expression reverts back to interpreted mode and then once again compiles.
Happens in varied scenarios with compiler mode MIXED, e.g.
Single expression instance, used frequently, with different "root" object classes
etc.

Example attached, prints out the number of loaded classes when the same expression is repeatedly evaluated for just 2 types of root object (simplest case).

One possible solution might be to have the SpelCompiler "store" classes for specific bytecode and check for identical bytecode generated (excepting compiled expression classname), returning the class that matches the bytecode instead of "defining" it again.
I have been unable to implement anything like this by extending as the structure of the code doesn't seem to provide the relevant hook points (in 4.1.6).


Affects: 4.3.8

Attachments:

Referenced from: commits c1edb3b

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions