0

I was trying to run an Java application of reading a file of 15MB file. But I am facing an issue with java.lang.OutOfMemoryError Java heap space error.

1
  • 4
    Please show us your code. Commented Jan 16, 2014 at 11:50

1 Answer 1

1

Either you change the code so that it uses less memory (for example, by only reading chunks of the file and not reading everything in memory), or you give more memory to your JVM:

java -Xmx512m ...

The above sets the maximum heap space to 512 MBs.

Its impossible to give a more precise answer on how to optimize the code without seeing the code.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.