Summary: | memory leak when doing post-compile time weaving | ||||||
---|---|---|---|---|---|---|---|
Product: | [Tools] AspectJ | Reporter: | Daniel Abramovich <dabramovich> | ||||
Component: | Compiler | Assignee: | aspectj inbox <aspectj-inbox> | ||||
Status: | RESOLVED FIXED | QA Contact: | |||||
Severity: | critical | ||||||
Priority: | P3 | CC: | aclement | ||||
Version: | DEVELOPMENT | ||||||
Target Milestone: | 1.6.0 | ||||||
Hardware: | PC | ||||||
OS: | Windows XP | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Daniel Abramovich
2006-10-16 16:14:28 EDT
Created attachment 52072 [details]
zip file that contains scripts to reproduce
Contains a zip file with an ant build script that will continually weave a jar and cause an OutOfMemory error. See contained readme.txt for other instructions.
Permgen problems indicate leaking classloaders holding onto classes. If I turn on -verbose:class and run your build.xml then I can see all the AspectJ classes are loaded many times (if we crash on the 15th iteration, I see they've been loaded 15times). If I remove the <antcall> in your xml and inline the iajc call at that point, I see the classes loaded once and the jar is woven fine any number of times (it is much faster too). This is all because <antcall> spawns a new classloader that is causing the reload of the whole compiler/weaver. The problem is I can't determine if it is AspectJ that has an anchored classloader reference in static somewhere - I can't see how we could leak classloader references when not loadtime weaving. So is it an Ant bug that after the antcall invocation the new classloader isn't released? As an aside, knowing that it's the <antcall> that's was causing the problem, I was able to "inline" the <iajc> invocation by using the ant <macrodef> tag (learn something every day). As a further aside, the way we're using a iajc is to do post-compile time weaving of numerous jars that have already been built. Right now there isn't a way with iajc to provide a list of jars and have each jar be woven in place. investigate for 1.5.4 - whether there is something to document here or a particular level of Ant to prereq. looks fixed in Ant 1.7.0 - your test program runs with that level. Possibly related blog post: http://www.mailinglistarchive.com/dev@ant.apache.org/msg04776.html |