Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] LTW is using high heap memory

Hi,

In order to implement meta programming efficiently, groovy does create
a lot of runtime state (caches describing reflective results on types,
caches for call site destinations, new classes are generated sometimes
to implement calls efficiently).  Might be worth grabbing a heap
snapshot to confirm the memory is going into these structures and not
somewhere else.

AspectJ shouldn't be artificially inflating the groovy numbers.  I
presume your aspects are code style and compiled with ajc - how are
you compiling the groovy code against which the aspects link, is that
via a separate earlier groovyc build?

And 60M sounds a little high for simple aspects only doing advice.
Have you let it run for a while to stabilise and go through a number
of GCs?  Weak/soft refs are used but even though they should have a
well defined behaviour I find you can be at the mercy of when your JVM
decides to collect them.  Perhaps attach jconsole and force some GCs
and leave it a little longer to settle down.

Moving to 1.6.12 won't get you any reduction over 1.6.11.

cheers
Andy

On 20 December 2011 21:34, Jayarajan, Divya <Divya.Jayarajan@xxxxxxx> wrote:
> Hi Andy,
>
> Thanks for your reply.
> I am using the AspectJ version 1.6.11. Normally my application takes 4MB of memory but when I implemented  AspectJ the memory spiked to 760MB on start up and then came down to 60MB.On further analysis it's found that I was calling groovy code in Aspect which was the reason for eating up all the memory.When I replaced those groovy code with Java,there is drastic drop in memory usage,which  remained at 60MB even on start up.
> So please help me understand why this groovy is the reason for shooting up the memory. I am not using ITDs but only advices.Is it normal that Aspect will take 60MB than the normal use of 4MB.Can I reduce it further if I use the latest version.i.e, 1.6.12.
>
> Thanks in advance,
> Divya
>
> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Andy Clement
> Sent: Wednesday, December 14, 2011 9:50 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: Re: [aspectj-users] LTW is using high heap memory
>
> Hi,
>
> First, make sure you are on a recent AspectJ - you don't mention which
> version.  As per
> http://www.eclipse.org/aspectj/doc/released/README-167.html (see the
> memory graphs in there) - you want to be on something later than
> 1.6.6, preferably 1.6.12.
>
> Memory will spike at startup as 'stuff' is woven but over time it will
> reduce as many things are only held by weak/soft refs - how those end
> up being collected, well you are at the mercy of how your chosen JVM
> is going to treat them, so it may take a number of GCs before the
> memory is recovered.
>
> Right now the only types permanently held onto by the weaver (so not
> linked by weak/soft refs) are aspects and types affected by ITDs, are
> you doing ITDs or just advice?
>
> There is a work item to have a weaver go to 'sleep' on disk and
> reinflate when required, but I haven't gotten around to doing that
> work yet.
>
> cheers,
> Andy
>
>
> On 13 December 2011 21:51, Jayarajan, Divya <Divya.Jayarajan@xxxxxxx> wrote:
>> Hi,
>>
>> I have written a .aj class for intercepting some methods of my
>> application.This works fine but I have observed that there is a large heap
>> memory consumption during the startup of the application after adding the
>> .aj class.If I remove the .aj class and restart the application, heap memory
>> consumption is normal (of-course I will not be able to execute intercepting
>> logic).I'm using loadtime weaving.
>>
>> I'm not able to figure out why there is so much memory needed at the
>> startup.Increasing the heap memory is not an option.
>>
>> Please suggest what can be done.
>>
>> Many Thanks,
>> Divya
>>
>>
>>
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top