Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Increase Memory?
Increase Memory? [message #179174] Fri, 15 September 2006 10:14 Go to next message
Eclipse User
Originally posted by: enomist.libero.it

Hello,

I have a text-file that includes some special characters (UTF-16), I
must write a java class that modifies the text, maintaining these
special characters. I try with:

in = new BufferedReader(new InputStreamReader( new
FileInputStream("PapersVecchio.txt"), "UTF-16"));

but the file is bigger than 135 Mb, and with this code the program return:

java.lang.OutOfMemoryError: Java heap space

What can I do?

thanks
Simone
Re: Increase Memory? [message #179192 is a reply to message #179174] Fri, 15 September 2006 15:02 Go to previous messageGo to next message
Seng Phung Lu is currently offline Seng Phung Lu
Messages: 62
Registered: July 2009
Member
Hi Simone,
how are you increasing the memory? Also, how much physical memory does
your machine have?

eclipse.ini sets -Xmx256m by default. Have you tried increasing this
value and re-starting the workbench.

Seng

Elbrethril wrote:
> Hello,
>
> I have a text-file that includes some special characters (UTF-16), I
> must write a java class that modifies the text, maintaining these
> special characters. I try with:
>
> in = new BufferedReader(new InputStreamReader( new
> FileInputStream("PapersVecchio.txt"), "UTF-16"));
>
> but the file is bigger than 135 Mb, and with this code the program return:
>
> java.lang.OutOfMemoryError: Java heap space
>
> What can I do?
>
> thanks
> Simone
Re: Increase Memory? [message #179199 is a reply to message #179192] Fri, 15 September 2006 15:20 Go to previous messageGo to next message
Eclipse User
Originally posted by: enomist.libero.it

Seng Phung-Lu ha scritto:
> Hi Simone,
> how are you increasing the memory? Also, how much physical memory does
> your machine have?
>
> eclipse.ini sets -Xmx256m by default. Have you tried increasing this
> value and re-starting the workbench.
>
> Seng

I have 1 Gb Ram. I try to set -Xmx516m or -Xmx1024m and re-starting the
workbench, but Eclipse return always the problem:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space.

I try to insert System.out.println("see where is the problem") in the
"While" that reads the file, the error returns when the program reads
the command "line = in.readLine();" but if I try with a small file there
aren't problems...
Re: Increase Memory? [message #179207 is a reply to message #179199] Fri, 15 September 2006 20:37 Go to previous messageGo to next message
Seng Phung Lu is currently offline Seng Phung Lu
Messages: 62
Registered: July 2009
Member
With 1G of physical memory, don't use -Xmx1024m. 512m or 768m should be
plenty! You should modify the eclipse.ini to pass this parameter.

Another option is, if you're not on the latest JRE already, try moving
up to the latest from Sun. I know there was an OutofMemory error fixed
in update 7(jre-1.50_07). Update 8 is now available.

Seng


Elbrethril wrote:
> Seng Phung-Lu ha scritto:
>
>> Hi Simone,
>> how are you increasing the memory? Also, how much physical memory
>> does your machine have?
>>
>> eclipse.ini sets -Xmx256m by default. Have you tried increasing this
>> value and re-starting the workbench.
>>
>> Seng
>
>
> I have 1 Gb Ram. I try to set -Xmx516m or -Xmx1024m and re-starting the
> workbench, but Eclipse return always the problem:
>
> Exception in thread "main" java.lang.OutOfMemoryError: Java heap space.
>
> I try to insert System.out.println("see where is the problem") in the
> "While" that reads the file, the error returns when the program reads
> the command "line = in.readLine();" but if I try with a small file there
> aren't problems...
Re: Increase Memory? [message #179232 is a reply to message #179207] Sat, 16 September 2006 09:15 Go to previous messageGo to next message
Eclipse User
Originally posted by: enomist.libero.it

I try with 768m and jre-1.50_08, but the problem remains.
What can I do?



Seng Phung-Lu ha scritto:
> With 1G of physical memory, don't use -Xmx1024m. 512m or 768m should be
> plenty! You should modify the eclipse.ini to pass this parameter.
>
> Another option is, if you're not on the latest JRE already, try moving
> up to the latest from Sun. I know there was an OutofMemory error fixed
> in update 7(jre-1.50_07). Update 8 is now available.
>
> Seng
>
>
> Elbrethril wrote:
>> Seng Phung-Lu ha scritto:
>>
>>> Hi Simone,
>>> how are you increasing the memory? Also, how much physical memory
>>> does your machine have?
>>>
>>> eclipse.ini sets -Xmx256m by default. Have you tried increasing this
>>> value and re-starting the workbench.
>>>
>>> Seng
>>
>>
>> I have 1 Gb Ram. I try to set -Xmx516m or -Xmx1024m and re-starting
>> the workbench, but Eclipse return always the problem:
>>
>> Exception in thread "main" java.lang.OutOfMemoryError: Java heap space.
>>
>> I try to insert System.out.println("see where is the problem") in the
>> "While" that reads the file, the error returns when the program reads
>> the command "line = in.readLine();" but if I try with a small file
>> there aren't problems...
Re: Increase Memory? [message #179275 is a reply to message #179232] Mon, 18 September 2006 16:47 Go to previous messageGo to next message
Seng Phung Lu is currently offline Seng Phung Lu
Messages: 62
Registered: July 2009
Member
Hi,
Before you launch your application in Eclipse, have you tried adding the
-Xmx512m argument in the VM arguments in the Arguments pane? Or launch
the java.exe with -vmargs -Xmx512m.

Note: 135MB is a very large text file by any standards, would it be
possible to separate them into many smaller files instead?

Seng


Elbrethril wrote:
> I try with 768m and jre-1.50_08, but the problem remains.
> What can I do?
>
>
>
> Seng Phung-Lu ha scritto:
>
>> With 1G of physical memory, don't use -Xmx1024m. 512m or 768m should
>> be plenty! You should modify the eclipse.ini to pass this parameter.
>>
>> Another option is, if you're not on the latest JRE already, try moving
>> up to the latest from Sun. I know there was an OutofMemory error
>> fixed in update 7(jre-1.50_07). Update 8 is now available.
>>
>> Seng
>>
>>
>> Elbrethril wrote:
>>
>>> Seng Phung-Lu ha scritto:
>>>
>>>> Hi Simone,
>>>> how are you increasing the memory? Also, how much physical memory
>>>> does your machine have?
>>>>
>>>> eclipse.ini sets -Xmx256m by default. Have you tried increasing
>>>> this value and re-starting the workbench.
>>>>
>>>> Seng
>>>
>>>
>>>
>>> I have 1 Gb Ram. I try to set -Xmx516m or -Xmx1024m and re-starting
>>> the workbench, but Eclipse return always the problem:
>>>
>>> Exception in thread "main" java.lang.OutOfMemoryError: Java heap space.
>>>
>>> I try to insert System.out.println("see where is the problem") in the
>>> "While" that reads the file, the error returns when the program reads
>>> the command "line = in.readLine();" but if I try with a small file
>>> there aren't problems...
Re: Increase Memory? [message #180264 is a reply to message #179232] Fri, 29 September 2006 12:45 Go to previous message
David Williams is currently offline David Williams
Messages: 696
Registered: July 2009
Senior Member
On Sat, 16 Sep 2006 05:15:50 -0400, Elbrethril <enomist@libero.it> wrote:

> I try with 768m and jre-1.50_08, but the problem remains.
> What can I do?
>
>

Another thing, in addition to Seng Phung-Lu good advice, when working with
files that size,
a common technique is to not work with the whole file in memory. Just to
give one possible
concrete flow ... you could read and re-write to a temp file, until you
detected where you
had to insert some java code, insert that into temp file, then continue on
until you detected
the next point to insert java code, etc. Finally, when all done, rename
the temp file to the
desired file name.

Also, are you literally just reading it in, and saving it? Or, is it also
open in an editor?
If open in an editor, that'll take a lot of extra memory, just to create
the eidtors "Document".
That will be even harder to do, but there are 'tricks' there, like turning
off "quick diff" which
might save some memory.

Hope this helps.

[this is not a true "web tools" question, so you might have more responses
asking on a general
java newsgroup ... and, interesting to know, do you really need something
from Eclipse?
If so, you might get working with "regular java" first, and if you get
that to work, and still
doesn't work in Eclipse, then you could investigate with a profiler to see
what extra things
were being created in Eclipse].
Previous Topic:How to install 1.5.1?
Next Topic:Support for Tomcat AntiJar Locking...Needed for Publishing...
Goto Forum:
  


Current Time: Thu Oct 02 08:43:00 GMT 2014

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

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