KMeans unit test memory leak fix