Error Management

Hi all!

I have some questions about memory management:

For example, I have those code:

[code]

cudaError er;

cudaMalloc(…);

er = cudaGetLastError();

cudaMemcpy(…);

er = cudaGetLastError();

[\code]

Let’s assume, “cudaMalloc” failes and cudaMemcpy is successful, then “er” should show an error, shouldn’t it?

And which error shows “er” if both functions failure?

Best regards!

Yes

The last one, as suggested by the name cudaGetLastError()