Hey, Glad that helped somewhat. You are experiencing the classic trade off now though: memory vs time. Some of the blog articles are a bit old, in many cases the options discussed have since become the default so you don't need to set them any more - which I believe is the case for minimalModel.
Hard to predict precisely what kinds of pointcut will consume more memory because it does somewhat depend what they are matching against. One of my blog articles was about pointcut timers, you could try using that to measure if your pointcuts are doing a lot of slow matching (as opposed to fast matching). Addressing that could get you down from 14minutes perhaps (or it may reveal pointcut matching isn't really a big time sink). > 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? Sounds like it is very close to running out of memory and doing lots of GC which is taking extra time - in that situation I have always just increased Xmx. You are doing something more complicated than a straight build so it is understandable that it needs a bit of extra space. Maybe with type demotion turned on, if you give it just a little extra memory rather than a massive amount you could see a big decrease from 14mins. cheers, Andy On 16 June 2016 at 06:18, Nuno GASPAR (contractor) <[email protected]> wrote: > 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:* [email protected] < > [email protected]> on behalf of Andy Clement < > [email protected]> > *Sent:* 15 June 2016 21:40 > *To:* [email protected] > *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 > > On 15 June 2016 at 10:26, Nuno GASPAR (contractor) < > [email protected]> wrote: > >> Hello. >> >> >> I'm using AspectJ in a rather big project, and I'm getting an >> OutOfMemoryException during the compilation process. I only have one aspect >> defined, with only one pointcut, and some regular logging code on before() >> and after() advices. >> >> >> This is a recurrent question, but so far I've only seen people >> recommending increasing the maximum amount of allocated memory through the >> -Xmx parameter. Indeed, this did solve my problem, but this is not really >> a good solution, since this code needs to be built by a software factory >> that may be performing other (compilation) tasks at the same time... >> >> >> I would like to know if there are any tips you can give me on how to >> lower the amount of memory needed by aspectj? >> >> >> I read that using incremental compilation can consume more memory, but >> indeed I'm not using it --- well, at least I do not have the option >> specified in my pom.xml. Maybe I should explicitly include >> >> <useIncrementalCompilation>false</useIncrementalCompilation> ? >> >> >> I also guess that the way a pointcut is specified matters, that is, if >> using regular expressions * or .. may require more memory? >> >> >> Any general tips you might have based on your past experiences? >> >> >> Best regards, >> >> Nuno >> >> >> >> _______________________________________________ >> aspectj-users mailing list >> [email protected] >> To change your delivery options, retrieve your password, or unsubscribe >> from this list, visit >> https://dev.eclipse.org/mailman/listinfo/aspectj-users >> > > > _______________________________________________ > aspectj-users mailing list > [email protected] > To change your delivery options, retrieve your password, or unsubscribe > from this list, visit > https://dev.eclipse.org/mailman/listinfo/aspectj-users >
_______________________________________________ aspectj-users mailing list [email protected] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/aspectj-users
