on 01-18-2008 8:02 AM
Hi everybody,
I get java.lang.OutOfMemoryError when reading a very huge file:
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
// the following thows the error
while ((strLine = br.readLine()) != null) {
How can I read huge files?
Thanks regards
Mario
Hello
try to increase the heap size when running your java program with the command line option -Xmx
java -Xmx256m your.program
and process the data efficiently inside the while loop
regards franz
reward points if useful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mario,
in the menu of eclipse, go to Run->Open Run Dialog. Then choose your Java Application and switch to the tab Arguments in the right part of the dialog.
In the field text-editor, you could insert the value '-Xmx256m' (use the string between the single quotation marks).
Apply your settings and start your program.
Greets
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.