cudaMalloc on cufftComplex array returns null

i have this bit of code:

cufftComplex *dst;

CUDA_SAFE_CALL(cudaMalloc((void **) &dst,(N_SAMPLES/2+1)* sizeof(cufftComplex)));

it is very similar to the examples code in documentation, N_SAMPLES is defined in a c++ .h file but i have no warnings or errors regarding this.
pointer dst remains null after this and i can’t figure out why …

i also have:
cudaMallocHost((void *) src,N_SAMPLES sizeof(int));

and this allocates memory perfectly…



  • cuda error state.
  • out of memory reason
  • types of your dst, src variables (one has & sign which means they are of different type or there is a mistype)

thank you very much for answering.

well i have a 8800 GT and i have tried with only one memory block so it is not an out of memory problem…
as you can see dst is a pointer so it has the & … src is int** so it doesn’t have a & …

care to elaborate on “cuda error state” ?
i’ll try to debug further on pointer stuff but it’s weird since it is the same line of the examples…

You have it wrapped in a CUDA_SAFE_CALL, which is good. Now compile it in debug mode and run it. CUDA_SAFE_CALL should write out the reason for the error.

problem is debug window has no error … the array just stays empty …

if i do:
cufftComplex dst[N_SAMPLES/2+1];

the array is good. i don’t get it why it doesn’t work with malloc …