Increasing heap memory can help a bit. However if you need to process a lot of objects at once, especially if that processing involves creating new bojects) then Mendix recommends to do this processing in batches or chunks.
There are several guides on how to do this, one here: https://docs.mendix.com/howto/monitoring-troubleshooting/detect-and-resolve-performance-issues#batches
In my experience batching can offer significant speed up sometimes up to 10x faster execution.
Hope this helps,