Hello Andrew.
Thanks for the type demotion tip, I can now compile without increasing the Xmx parameter value :-)
By the way, I found what appears to be one of your blogs [1], and you also mention something about
minimalModel . Would you recommend using it as well?
Regarding type patterns on pointcuts, well, I have all of them specified "explicitly", e.g.
execution(SomeType com.aaa.bbb.ccc.method1(SomeOtherType))
My first thought was indeed that this would require less memory than, say,
execution(* *.method1(*))
because it would narrow down the classes where the weaving might occur. Am I wrong to assume this?
For last, using type demotion did indeed help, however, compilation time on my laptop went from ~6 minutes to ~14 minutes. This is not really good. Are these times more or less what you guys have seen in your previous experiences with AspectJ?
Thank you for your time.
Best,
Nuno
[1]
http://andrewclement.blogspot.fr/2010/07/ajdt-memory-usage-reduction.html
From: aspectj-users-bounces@xxxxxxxxxxx <aspectj-users-bounces@xxxxxxxxxxx> on behalf of Andy Clement <andrew.clement@xxxxxxxxx>
Sent: 15 June 2016 21:40
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] OutOfMemoryException on compilation
Hi Nuno,
Make sure you are on a recent AspectJ. You could also try turning on type demotion - it is a -Xset option, don't quite recall how to turn those on via maven (-Xset:typeDemotion=true). Type demotion tries to run with a smaller footprint by throwing things away
more eagerly. If it needs them again later it pulls them back in. I thought it was on by default but very quickly browsing the code it seems to be only automatically on for load time weaving or when using it in an IDE environment.
Normally I'd say the use of wildcards is more likely to impact compilation time than memory usage, however depending on how your pointcut is written AspectJ may need to chase down supertypes and interfaces to determine a match. The more of those that need
to get chased down the more memory is likely to be used. In these situations using wildcards would save a little memory because we can tell immediately that * matches something without needing to look at the supertypes of the potential match. Are you using
declaring type patterns in your pointcut (execution(* Foo.*(..))) or not (execution(* *(..)) - the former is what may need more chasing/loading of types (having to dig into whether a target is a subtype of Foo). Are you using execution() or using call(),
the former is likely to be a bit cheaper. If you can add a scope to your pointcut, do so (i.e. a within clause).
cheers,
Andy
|