Hi Richard,
This topic has been discussed so many times in the forum. You will be able to get a lot of advice on this error by simply searching in forum.
In general, the error occurs when the JVM spent too much time performing Garbage Collection and was only able to reclaim very little heap space.
If my assumption is right, you might be processing too much of data at the same time, which flooded your JVM memory and cannot free up when needed. If this is true, try to do batch processing.
In general, the solution advice will be to prevent memory leaks in your program; being careful about the following factors can help you avoid this error:
Identify the objects in your application that occupy a large space on the heap.
Identify the places in your application where memory-allocation on the heap is done.
Avoid creating a large amount of temporary or weakly-referenced objects since they increase the chances of memory leakage.
It looks like the LDAP module tries to import a large amount of users from your ldap module. Too many.
If it fits your configuration, you may to look at the SAML module instead of loading all users into the mendix database using the ldap module.