We are seeing a memory leak in ProxyFactory when using cglib. I will attach a picture of the references.
Class memory leak
MemoryLeak in Cglib2AopProxy.ProxyCallbackFilter
Cglib2AopProxy weak reference causes perm space to fill up
Memory reference picture
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.
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.
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.
This is confirmed to fix at least one leak.
Updated patch. I found another leak.
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).
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 SPR-4004)
Thanks in advance,