Home » Language IDEs » ServerTools (WTP) » Increase Memory?
Increase Memory? [message #179174] |
Fri, 15 September 2006 10:14 |
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 #179199 is a reply to message #179192] |
Fri, 15 September 2006 15:20 |
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 #179232 is a reply to message #179207] |
Sat, 16 September 2006 09:15 |
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 |
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 |
David Williams Messages: 722 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].
|
|
|
Goto Forum:
Current Time: Mon Sep 23 16:47:16 GMT 2024
Powered by FUDForum. Page generated in 0.04193 seconds
|