   // free CPU memory
   if (block_tot > 1) free(buffer);
   
-  #ifndef SINGLE_ALLOC_GPU
+  #ifdef DYNAMIC_GPU_ALLOC
   // If memory is not single allocated then free the memory every timestep.
   Free_Memory_VL_3D();
   #endif

  #endif


  #ifdef SINGLE_ALLOC_GPU
  chprintf( " VL_3D: Memory freed successfully \n");
  #endif
}

    CudaSafeCall( cudaMalloc((void**)&dev_dt_array, ngrid*sizeof(Real)) );
    #endif 
    
    #ifndef DYNAMIC_GPU_ALLOC 
    chprintf( " VL_3D: Allocating memory \n");
    chprintf ( "  N memory blocks gpu: %d\n", block_tot );
    // If memory is single allocated: memory_allocated becomes true and succesive timesteps won't allocate memory.
