limit used memory and size of objects in partitionBy()