     checkCuda(cudaFree(deviceIntermediates));
 //  checkCuda(cudaFree(deviceNewClusterSize));
 
+    free(dimObjects[0]);
+    free(dimObjects);
     free(newClusters[0]);
     free(newClusters);
     free(newClusterSize);

    int     *newClusterSize; /* [numClusters]: no. objects assigned in each
                                new cluster */
    float    delta;          /* % of objects change their clusters */
    float  **clusters;       /* out: [numClusters][numCoords] */
    float  **newClusters;    /* [numClusters][numCoords] */


    __syncthreads();

    int objectId = blockDim.x * blockIdx.x + threadIdx.x;

    if (objectId < numObjs) {
        int   index, i;
