Java Heap Space Error While Running App in Local

0
Dear Experts,    When I'm running the Application, I'm getting the Java Heap Space error in console and application is not running. These are the steps which i tried: 1. Increased the Java heap space size to 1024MB in server setting configurations. 2.  Updated the JDK version to 21. 3. Restarted my pc multiple times   When i delete the existing data folder in application and run It's working fine, After running the application multiple times, Again getting the same error and not able to run the application. I'm using mendix 10.11.0.  
asked
3 answers
1

Hi Naga,

 

Honestly your 2nd picture is blur I could not see the log clearly, but last time I meet Java Heap Space error is cause by I have pulled too much text data trying to convert them into objects to be processed and committed.

 

You can try monitor your device memory in task manager, see if what is happening. I suspect there is microflow or any after startup microflow is having too much data processing in once when your application startup after multiple runs.

 

If your problem is the data being in transaction is too much until reach your device limit, you can try to limit the microflow call handle chunk of data 1000-5000 per loop, so the microflow does not over your device's memory limit.

answered
1

The Java Heap Space error you're experiencing actually indicates that your application is exhausted with the allocated memory in the Java heap. I would say, since you're using Mendix 10.11.0, which runs on the JVM, this error is tied to how Java manages memory and garbage collection.

 

It seems like you have already tried increasing the heap to 1024MB, which is a good starting point. But anyway, depending on the volume of data being loaded or retained in memory, this may still not be sufficient.

I have a few suggestions from my end,

  • Though you have increased, try to increase the heap size further based on your machine's capacity.
  • You should monitor GC logs. This can be done by enabling GC logs. Doing this will share the explicit info of objects that are staying in memory longer than expected.
  • Kindly have a look at any loops, data retrievals, or custom Java actions in your app that may not release memory properly.
  • Try to use profiling tools like HeapHero to inspect heap usage and identify memory leaks or hotspots.

As you mentioned you are facing this issue often, you can try to familiarize yourself with how Java memory management and garbage collection work. refer to this blog

answered
0

You could also capture the heap dump, if its local you could do a heap dump. If it is cloud you can contact Mendix support to create a heapdump for you.

answered