GPUassert: an illegal memory access was encountered

I got this error while copying from the device to host using cudaMemcpy. For error checking, I have used Cuda error API. What is the reason for getting the error??

Your kernel code is making an illegal memory access. You can use the method here to get more information on it.