Unable to allocate memory on the GPU?

#define N 10

#define D 3

float *features;

void copy_to_gpu()

{

 float* d_features;

 cutilSafeCall( cudaMalloc( (void**) &d_features, N*D*sizeof(float) ));

 cutilSafeCall( cudaMemcpy( d_features, features, N*D*sizeof(float), cudaMemcpyHostToDevice) );

}

The cudaMalloc give the error:

*** glibc detected *** ./template: free(): invalid next size (normal): 0x000000000062e230 ***

Any idea why?

don’t you never use device || global || host,… for functions and variables !?