Hi Eric,
AspectJ load-time weaving is still quite
memory intensive although it has improved a lot since 1.5.0. For example, I
found that starting Tomcat with some small applications without AspectJ
load-time weaving requires 11mb of heap and 18 mb of non-heap memory. If I
deploy a development version of Glassbox with AspectJ 1.5.2 rc1, it requires 41
mb of heap and 23 mb of non-heap memory. (*)
In the meanwhile, one technique you can
use to limit memory use by the weaver is to use the include type patterns to only
weave into code you need to affect. E.g., if you have an application specific
aspect, if you add <include within=”com.myco.myapp..*”/> to
your META-INF/aop.xml then you should find a much lower memory overhead.
(*) I am working on two ideas for
improving this situation:
* The patch submitted with AspectJ enhancement
#148773 reduces the heap required to 33 mb
* Allowing loading common aspect
definitions once per system instead of many times with many copies. Memory
profiles show me that most of the overhead is pinned by having 10 copies of the
weaving definitions one for each ClassLoader affected. This could also reduce
the time overhead for weaving, too. The tricky part about doing this is to
support nondelegating ClassLoaders that provide a different definition of parent
types.
Hope that Helps,
Ron
From:
aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Erc Crahen
Sent: Tuesday, June 27, 2006 12:42
AM
To: aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users]
OutOfMemryError LTW
When using the load time weaving agent, I'm runing into OutOfMemory
errors. I think that it could be that some of my classes refer to so many other
classes that the bytecode intrumentation pieces are running of heap weaving the
aspects.
Is there any debugging or anything I can do to confirm this? Or aleviate it? I
have a 96M heap which is plenty when the app runs w/o weaving on...
- Eric
Want to be your own boss? Learn how on Yahoo!
Small Business.