Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Big text file into textarea  RSS feed

 
Timo Lumme
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
im adding & reading into textarea, a huge text file but the results
end up with error:

NUM: 12845052
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
Press any key to continue...

the NUM: value is current number of char read into textarea from the
start(from file). the total size of textfile is 32.6mb full pi numbers.

possible workaround:
i could read into vector chunk of numbers, like 10 000,
then display it into textarea, then check em thru "do some
number matrix calculation or such" and then clear the textarea,
and read next chuck of numbers into vector, and so on.

do know any better solution this kind off problem or workaround?

p.s. why is the java so limited when comes things like this?
example, add numbers or cats into a vector, until it crashes, and print
out number of cats, currently in there, aint so much it can hold in, lol.
 
Lucas Lee
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you really need read so big file, you can set the JVM parameter "-Xmx" to enlarge the maximum memory usage. The default value is 64M, it seems too small to your situation. You can see the parameter desciption in JDK document.
 
Timo Lumme
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
added java -Xmas512m -Xmx1024m into jcreator JDK tools -> run application
settings window. works fine
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!