Ramesh katru
Ramesh katru

Reputation: 21

Java out of memory message while reading large CSV file

We are trying to compare 2 CSV files which are of 3 gb size. We are receiving java heap memory error while trying to read these files with CSV map reader.can anybody please help me to solve this issue.

Upvotes: 1

Views: 838

Answers (1)

ocaptchamycaptcha
ocaptchamycaptcha

Reputation: 185

One option is to expand the memory for the heap. The initial heap size is 128 megs by default. Java has a flag you can pass it to increase this value.

You can initialize the heap size with -Xms[size] or you can give the JVM a maximum heap size with -Xmx[size].

In your case I would use -Xms to give the program more memory. For instance if you want the heap size to start out at 512 MB then when running the program you would run:

java -Xms512m programName 

Upvotes: 1

Related Questions