Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Class Reloading and Load Time Weaving

I thought we had added a method for forcing them to be collected (even
though it shouldnt be needed and if we are holding onto them, it is a
bug) - but on browsing that area of the code, I can't find anything.
If you raise a bug, I will look at it when I get a chance.

Andy.

On 15/11/2007, Eric Grunzke <eric.grunzke@xxxxxxxxx> wrote:
> I'm working on a project that generates a lot of code and uses a
> custom ClassLoader to pull generated classes into the JVM.  My
> structure allows for reloading (by orphaning the old loader and
> creating a new one) in the event that code is regenerated.
> Additionally, I have enabled load-time weaving to add some behavior to
> the generated classes as they are loaded.
>
> My problem here is that once I enable load-time weaving, orphaned
> class loaders are *not* garbage collected.  With some investigation,
> I'm pretty convinced that the Load Time Weaver is holding on to
> references of class loaders that have otherwise been abandoned.  As
> long as a reference is maintained to the loader, it will not be
> garbage collected, and all of the classes it loaded will similarly
> stay in memory.
>
> The bottom line is that this is a memory leak.  Classloaders (and
> Classes they load) are never released, so every reload increases
> memory usage, until the VM eventually crashes.  Is there a way for me
> to tell AspectJ to release a classloader that is no longer being used?
>
> Thanks,
> Eric Grunzke
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top