Heap space errors usually indicate that the atom is running out of memory while trying to run processes. You could try the following to resolve this error:
1. If it is a local atom, try increasing the atoms memory allocation by following the instructions here:
2. Redesign the process so that it picks up smaller batches of data for each run.