0

I recently updated my eclipse to:
Version: 2019-12 (4.14.0) Build id: 20191212-1212
I am now facing the problem in one of my projects (Which I did not before):
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

I already changed my elipse.ini parameters to: -Xms2048m -Xmx6144m

But the heap space is not fully used during the run:

Usage of heap space]

My CPU-Usage is at 100% during the run and the RAM is not really in usage.
Can someone tell me why the cpu is used to this extent and not the ram?

I have an Intel Core i7-9700 and 16GB of DDR4 RAM.

As for my code, I am loading a .csv file with 2 million lines into different HashMaps.

I do not know how to add the class which is responsible for the error, as it has 1776 lines of code.

Thanks for any help in advance.

akBen
  • 37
  • 1
  • 7
  • use step-by-step debugger and see where the resource usage bursts – jhamon Feb 10 '20 at 10:57
  • Can you please try to load data from CSV file in batches? – Developer Feb 10 '20 at 10:59
  • AFAIK sets eclipse.ini the settings for eclipse, not the started java-classes, see http://www.planetofbits.com/eclipse/increase-jvm-heap-size-in-eclipse/ – Turo Feb 10 '20 at 11:01
  • The eclipse.ini setting give the heap size for Eclipse. But I think you are saying that the problem is occurring in an application. Set the heap parameters in the app launch configs. – Stephen C Feb 10 '20 at 11:01
  • *"Can someone tell me why the cpu is used to this extent and not the ram?"* - Assuming that we have the correct diagnosis ... it is because you are looking at the Eclipse heap size not the application heap size. – Stephen C Feb 10 '20 at 11:04
  • I changed the heap size in the run configurations and the .ini . Sry forgot to mention that. @Rahul how do you mean that? How can I achive that? – akBen Feb 10 '20 at 11:05
  • -.- sry. But I found the problem. As most of you suggested I had to change the run configurations for the heap size. I doubled them to: -Xms2048m -Xmx4096m and now my application is running without an error. Thank you all. – akBen Feb 10 '20 at 11:21
  • @akBen You can use the concept of FileSystem.First try to get line count.After that suppose you have 10,000 lines then try to read 1 to 1000 in first batches process that ,once processing done again try to read 1001 to 2000 like-wise you can move further. – Developer Feb 10 '20 at 12:09

0 Answers0