hierarchical clustering runs out of memory