java - BufferedReader with FileReader use alot of RAM -
i use bufferedreader , filereader on big files (~100g)
bufferedreader reader = new bufferedreader(new filereader("file path")); bufferedwriter writer = new bufferedwriter(new filewriter("output file")); string line; while ((line = reader.readline()) != null) { // check if need line, , if need it, print writer.write(line); writer.newline(); } writer.close(); reader.close();
when run source on files, in beginning use low memory, used memory grows(can use on 50g of ram).
why it's that? , can fix it?
i see when run java program on linux command line -xmx
parameter, reason make java program need alot of ram.
from when remove -xmx
parameter, java program use low memory.
this old command:
java -xmx350g -jar myjar.jar
this new command:
java -jar myjar.jar
Comments
Post a Comment