|
From: Andy D. <an...@ma...> - 2004-10-19 17:38:01
|
People are beginning to use Spring to do dependency injection and apply=20 aspects (CGLIB) for objects created at runtime (via Hibernate, for example)= =2E =20 Moreover, we have toyed with the idea of applying aspects to objects we=20 dynamically create at runtime to enforce certain security constraints and t= o=20 facilitate distributed object models in a cluster - in which case the aspec= ts=20 are chosen dynamically and could change quite frequently. The dynamic natu= re=20 of all this could land us in the middle of this issue. What would the=20 ramifications be if these proxy classes were modified to use weak reference= s=20 instead of strong? Is this even a possibility? - Andy On Tuesday 19 October 2004 09:35 am, j=FCrgen h=F6ller [werk3AT] wrote: > I've just been made aware of the following by a werk3 colleague: When > repeatedly creating CGLIB proxies for the same target class but for > different advices - within the same class loader -, you'll create new > proxied classes all the time, which won't get removed for the lifetime of > the classes. > > The generated classes themselves are not the problem here. However, each = of > those proxy classes seems to hold strong references to its advices and > target object, through holding the ProxyCallbackFilter instance that was > passed into the Enhancer on proxy creation. Note that the proxy *class* > holds that reference, not the proxy *instance*. |