Skip to content

ProxyFactory memory leak using cglib [SPR-3620] #8302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Jun 25, 2007 · 9 comments
Closed

ProxyFactory memory leak using cglib [SPR-3620] #8302

spring-projects-issues opened this issue Jun 25, 2007 · 9 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jun 25, 2007

Andy Piper opened SPR-3620 and commented

We are seeing a memory leak in ProxyFactory when using cglib. I will attach a picture of the references.


Affects: 2.0.5

Attachments:

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

Andy Piper commented

Memory reference picture

@spring-projects-issues
Copy link
Collaborator Author

Andy Piper commented

I think that the bug is in ProxyCallbackFilter. cglib maintains a hard reference to this in the key and so the value doesn't go away. I suspect by making the fixedInterceptorMap and advised fields weak this may cure the problem.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

This might be a general memory leak problem with CGLIB, I'm afraid. If we make Spring's fields weakly referenced there, the CGLIB class itself will probably still stay around in memory. Of course the leak would show less effect then... so that might already help.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Andy Piper commented

I'm not so sure. cglib correctly uses a WeakHashMap, with Spring fixed things might be ok. I'll attach the candidate fix that I am testing.

@spring-projects-issues
Copy link
Collaborator Author

Andy Piper commented

Candidate fix

@spring-projects-issues
Copy link
Collaborator Author

Andy Piper commented

This is confirmed to fix at least one leak.

@spring-projects-issues
Copy link
Collaborator Author

Andy Piper commented

Updated patch. I found another leak.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

I have fixed this in CVS HEAD (for 2.1 M3) and mbranch-2-0 (for 2.0.7). This should be available in the next 2.1 M3 as well as 2.0.7 snapshots (tonight / tomorrow).

Juergen

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Nov 9, 2007

Juergen Hoeller commented

Andy, could you please re-test a current 2.5 RC2 / 2.0.8 snapshot with respect to this leak? I had to revise Cglib2AopProxy again since the fixes that you suggested here unfortunately caused a side effect with the reuse of CGLIB proxy classes... (see #8684)

Thanks in advance,

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants