java.lang.OutOfMemoryError - but I still have memory

Occasionally my app hosted in Mendix cloud will give me a "java.lang.OutOfMemoryError: Java heap space" error and then shut down/restart. When I look at the metric. Everything looks fine. The metrics heap space generally looks like this My memory usage is consistently around 3-3.4GB out of 4. It's high (75-85%) but that shouldn't be high enough for it to just shut down. I don't see anything in the logs when these things happen. No burst of users or queries being run or anything. Does anyone know what could cause this?
1 answers

This specific error means that you ran out of memory inside the running thread (microflow). The server basically assignes a specific amount of memory to 1 thread and that is running out which is causing the error. If I remember correctly a standard environment has 254 threads and the amount of memory is divided by that amount. Thats why if you look at the graph itself it will look like you still have enough heapspace.