A possible reason for previously mentioned ‘out of memory’ error, is that size of the larger batch generated by to_pieces is variable. It depends on the length of input records, and may caused that error when it became too large.