About Memory Error Solution

Hi There,   In Mendix, garbage collection is not performed until the microflow is finished. Therefore, memory is not released. As a result, handling large amounts of data results in a shortage of memory.    java.lang.OutOfMemoryError: Java heap space   To solve this problem, the logic must take memory usage into account. Do you have any ideas?   Thanks!! Iwata
1 answers

Hi Suguru, 


How is the microflow structured that you are trying to refactor?

If it is a large set of objects, what you can do is implement batching. You can then process batches of, for example, 500 items per iteration. After every batch you can clean up lists so you won't be out of memory.


In additon you can try to use the ‘Finish transaction’ and ‘Start transaction’ Java actions from Community Commons. These make sure that not all objects you are processing are kept in memory untill the microflow is done. A downside from this is that if an error occurs, the batches that alrady have been commited will not be rolled back.