With big datasets, the process is getting killed after completely eating up all the physical and virtual memory on the machine! I'll need to switch to doing this in batches...