Java heap Memory issue
An error is thrown by the Java Virtual Machine when it finds that not enough memory is left for storing the object in the heap space, and as a result, the JVM throws an error that it cannot allocate the object because there is no more space is left for storing it.
2.Impact of the problem:
Heap out of memory is a major issue to be considered by the developer when working will large amount of data. If the amount of data exceeds the limit “out of space or out of memory error” will be thrown, which cannot be handled. And in local system level server will be stopped & on cloud Hub server redeployment will happen but cannot resolve this.
The easiest solution to remove such error is to increase the memory size of the JVM heap space. To increase the size of the heap space, use “-Xmx” java options to solve the out-of-memory error. This configuration will provide 1024 heap space to the application. However, increasing the heap size will not cover all the necessary errors (such as memory leaks) for your application that is running on the JVM. And developer who works on large set of data always ensures while reading & uploading, the “streaming strategy” was enabled or not. If not, then needs to be enabled.
To increase the heap memory size:
1.Open the anypoint.ini file of your Any point studio IDE as shown below:
2. Now change Xmx values as per your system requirement as shown below:
3. From Any point studio increase the heap size in the arguments:
- Studio Menu -> Run -> Run Configurations… -> Select the Mule Application
- In VM Arguments, increase the value for XX:MaxPermSize to increase the Perm Size or add the -Xmx param to increase the Heap, i.e.: -Xmx1024M
Always ensure unnecessary payload logging needs to be avoided, Increase the VCore value on cloud Hub level & heap memory size on the local system level whenever the “Out of memory problem encounters. But be cautious, it will be applicable only if the client or the management level provides an approve status.