Forums Register Login

Big text file into textarea

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
added java -Xmas512m -Xmx1024m into jcreator JDK tools -> run application
settings window. works fine
Yup, yup, yup. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1508 times.
Similar Threads
empty vector cells
How to Add the Text field to the TextArea or TextPane
Cpp create file, java read it, how to do this
Code problem
TextArea wrapping
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 00:27:50.