NVIDIA’s documentation is extensive. The programming guides, best practices guides, and API references are generally thorough, and the online community (forums, StackOverflow) is massive because the user base is so large.
// Free host and device memory free(aHost); free(bHost); free(resultHost); cudaFree(aDevice); cudaFree(bDevice); cudaFree(resultDevice); cuda toolkit