Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » OutOfMemory on Resource.save()
OutOfMemory on Resource.save() [message #740519] Tue, 18 October 2011 15:45 Go to next message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi,

I have a big XMI Resource (a file of 30MB in average) on which I do many
changes (migration processing), at the end I do a Resource.save() but I
get a OutOfMemory error. Taking a memory snapshot with Memory Analyzer,
I see that the biggest object is taken by a array
org.eclipse.emf.ecore.xmi.impl.StringSegment$Element[] taking 250MB in
average and the OutOfMemoryError occurs at StringElement.write() more
precisely at :

at java.util.Arrays.copyOf(2786)
at java.io.ByteArrayOutputStream.write(94)
at sun.nio.cs.StreamEncoder.writeBytes(202)
at sun.nio.cs.StreamEncoder.implWrite(263)
at sun.nio.cs.StreamEncoder.write(106)
at java.io.OutputStreamWriter.write(190)
at org.eclipse.emf.ecore.xmi.impl.StringSegment.write(407)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.write(1009)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(266)
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(206)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(1406)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(993)

With a sun jvm 1.6.0_26 on Linux Ubuntu.

Someone has already had similar issues or have a idea of this big memory
usage?

Best Regards.
Re: OutOfMemory on Resource.save() [message #740535 is a reply to message #740519] Tue, 18 October 2011 16:06 Go to previous message
Ed Merks is currently online Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Esteban,<br>
<br>
You'll want to try using<br>
<blockquote>&nbsp; /**<br>
&nbsp;&nbsp; * Write the intermediate results of serialization to the file
system rather to an in-memory buffer.<br>
&nbsp;&nbsp; * This helps to reduce memory requirements for serializing a
large file, but it's slower.<br>
&nbsp;&nbsp; * The default is &lt;code&gt;Boolean.FALSE&lt;/code&gt; unless
set to &lt;code&gt;Boolean.TRUE&lt;/code&gt; explicitly.<br>
&nbsp;&nbsp; */<br>
&nbsp; String OPTION_USE_FILE_BUFFER = "USE_FILE_BUFFER";<br>
</blockquote>
<br>
<br>
On 18/10/2011 5:45 PM, Esteban Dugueperoux wrote:
<blockquote cite="mid:j7k68d$qba$1@news.eclipse.org" type="cite">Hi,
<br>
<br>
I have a big XMI Resource (a file of 30MB in average) on which I
do many changes&nbsp; (migration processing), at the end I do a
Resource.save() but I get a OutOfMemory error. Taking a memory
snapshot with Memory Analyzer, I see that the biggest object is
taken by a array
org.eclipse.emf.ecore.xmi.impl.StringSegment$Element[] taking
250MB in average and the OutOfMemoryError occurs at
StringElement.write() more precisely at :
<br>
<br>
at java.util.Arrays.copyOf(2786)
<br>
at java.io.ByteArrayOutputStream.write(94)
<br>
at sun.nio.cs.StreamEncoder.writeBytes(202)
<br>
at sun.nio.cs.StreamEncoder.implWrite(263)
<br>
at sun.nio.cs.StreamEncoder.write(106)
<br>
at java.io.OutputStreamWriter.write(190)
<br>
at org.eclipse.emf.ecore.xmi.impl.StringSegment.write(407)
<br>
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.write(1009)
<br>
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(266)
<br>
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(206)
<br>
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(1406)
<br>
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(993)
<br>
<br>
With a sun jvm 1.6.0_26 on Linux Ubuntu.
<br>
<br>
Someone has already had similar issues or have a idea of this big
memory usage?
<br>
<br>
Best Regards.
<br>
</blockquote>
</body>
</html>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:EMF Integration With Legacy Data Store
Next Topic:[CDO]Legacy mode switched off
Goto Forum:
  


Current Time: Fri Apr 26 06:06:24 GMT 2024

Powered by FUDForum. Page generated in 0.02474 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top