Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo 3] Problems in memory management
[Acceleo 3] Problems in memory management [message #647996] Mon, 10 January 2011 12:26 Go to next message
Alexandre Cortier is currently offline Alexandre Cortier
Messages: 9
Registered: January 2011
Junior Member
Hi,

When I launch a lot of transformations (using the 'main' Java class generated by Acceleo (main tag on my template)),
I have a problem with the memory management : the heap-status displayed in my Eclipse never decreased.
It seems that memory is not unloaded.

How can I avoid this ?


Thanks for your answer,

Alex
Re: [Acceleo 3] Problems in memory management [message #648092 is a reply to message #647996] Tue, 11 January 2011 03:20 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1621
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020800000105050202070108
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Alex,

The memory allocated by Acceleo transformations should be properly
disposed of at the end of the generations ... We haven't really observed
problems with generations targetting ecore, UML, GenModel or custom DSL
so far.

What is the metamodel of the models from which you generate code? And
are you sure that these models/metamodels don't need custom steps when
unloading (which could be the case for custom DSLs)? Don't you use Java
services from your generation which allocate memory in static fields?

This kind of issues could have many, many different sources... Your best
bet is to profile the application and dump the memory after a number of
generations so that you can check what's in heap.

Laurent Goubet
Obeo

On 10/01/2011 18:26, Alexandre Cortier wrote:
> Hi,
>
> When I launch a lot of transformations (using the 'main' Java class
> generated by Acceleo (main tag on my template)), I have a problem with
> the memory management : the heap-status displayed in my Eclipse never
> decreased.
> It seems that memory is not unloaded.
>
> How can I avoid this ?
>
>
> Thanks for your answer,
>
> Alex


--------------020800000105050202070108
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------020800000105050202070108--
Re: [Acceleo 3] Problems in memory management [message #648177 is a reply to message #648092] Tue, 11 January 2011 11:13 Go to previous messageGo to next message
Alexandre Cortier is currently offline Alexandre Cortier
Messages: 9
Registered: January 2011
Junior Member
Hi Laurent,

We tested memory : objects are kept by Inverse Cross Referencer of the UML cache adapter.
We added break point on the unload statement of the ResourceImpl class : this statement is never called. Is it normal ?

Thanks for all,

Alexandre Cortier

Re: [Acceleo 3] Problems in memory management [message #648270 is a reply to message #648177] Wed, 12 January 2011 03:35 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1621
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050109070907050609060501
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Alexandre,

UML creating its own Cross referencer is a memory issue we've seen in a
number of our projects. As Acceleo doesn't explicitely unload the
resources it loads, you will have to manually take care of it for UML
resources.

Namely, you will have to override the "doGenerate" method of the
generated Java launcher (the Java class beside the module which contains
your "@main" annotation) with a code such as :

/**
* Launches the generation.
*
* @param monitor
* This will be used to display progress information to the
user.
* @throws IOException
* Thrown when the output cannot be saved.
* @generated NOT
*/
@Override
public void doGenerate(Monitor monitor) throws IOException {
super.doGenerate(monitor);

// Unload UML resources (memory issues)
ResourceSet rs = getModel().eResource().getResourceSet();
for (Resource resource : rs.getResources()) {
if
(UMLResource.FILE_EXTENSION.equals(resource.getURI().fileExt ension())) {
resource.unload();
}
}
}

Laurent

On 11/01/2011 17:13, Alexandre Cortier wrote:
> Hi Laurent,
>
> We tested memory : objects are kept by Inverse Cross Referencer of the
> UML cache adapter.
> We added break point on the unload statement of the ResourceImpl class :
> this statement is never called. Is it normal ?
>
> Thanks for all,
>
> Alexandre Cortier
>
>


--------------050109070907050609060501
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------050109070907050609060501--
Re: [Acceleo 3] Problems in memory management [message #649448 is a reply to message #648270] Wed, 19 January 2011 04:14 Go to previous message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1621
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050808040703090201000804
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

In case any one wonders, the two bugzillas
https://bugs.eclipse.org/bugs/show_bug.cgi?id=334264 and
https://bugs.eclipse.org/bugs/show_bug.cgi?id=334283 have been opened to
tackle the issues raised by this thread. Both are now fixed and will be
available in 3.0.2RC1 and 3.1.0M5.

Laurent Goubet
Obeo

On 12/01/2011 09:35, Laurent Goubet wrote:
> Hi Alexandre,
>
> UML creating its own Cross referencer is a memory issue we've seen in a
> number of our projects. As Acceleo doesn't explicitely unload the
> resources it loads, you will have to manually take care of it for UML
> resources.
>
> Namely, you will have to override the "doGenerate" method of the
> generated Java launcher (the Java class beside the module which contains
> your "@main" annotation) with a code such as :
>
> /**
> * Launches the generation.
> *
> * @param monitor
> * This will be used to display progress information to the user.
> * @throws IOException
> * Thrown when the output cannot be saved.
> * @generated NOT
> */
> @Override
> public void doGenerate(Monitor monitor) throws IOException {
> super.doGenerate(monitor);
>
> // Unload UML resources (memory issues)
> ResourceSet rs = getModel().eResource().getResourceSet();
> for (Resource resource : rs.getResources()) {
> if (UMLResource.FILE_EXTENSION.equals(resource.getURI().fileExt ension())) {
> resource.unload();
> }
> }
> }
>
> Laurent
>
> On 11/01/2011 17:13, Alexandre Cortier wrote:
>> Hi Laurent,
>>
>> We tested memory : objects are kept by Inverse Cross Referencer of the
>> UML cache adapter.
>> We added break point on the unload statement of the ResourceImpl class :
>> this statement is never called. Is it normal ?
>>
>> Thanks for all,
>>
>> Alexandre Cortier
>>
>>
>


--------------050808040703090201000804
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------050808040703090201000804--
Previous Topic:[Acceleo 3] recursive import not supported
Next Topic:[Xtend] Model modification of a UML model using a profile
Goto Forum:
  


Current Time: Thu Jul 24 13:44:06 EDT 2014

Powered by FUDForum. Page generated in 0.02716 seconds