I am getting an OutOfMemoryError. How do I solve this?
Error: java.lang.OutOfMemoryError: Java heap space
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to either increase the available heap space (with the Java
-Xmxflag) or use less memory in your application.I’d recommend that you try to use less memory. There are plenty of good profiling tools out there that you can use to discover where your code uses a lot of memory. It’s also worth checking that you are not misusing any
HashMaps orObjectOutputStreams. Those two classes are notorious for soaking up memory if not used properly.