cudaMalloc in .cu file degenerate

Hi all,
this is my new strange question.

I have this:

void cudaExactInit()
    double *constants; 

    cudaMalloc((void **)&constants, 13 * sizeof(double) ); 

cudaFree(constants) ; 

If i execute this in my “main” c++ program, it’s ok: start, alloc, dealloc, close.
The same code executed in a .cu file does: start, alloc, dealloc, NEVER END. Program hang up forever in task manager, why that happen? How solve? (program reach correctly the end of main, but just never end)

You may have a corrupted CUDA install or an otherwise broken machine environment. There shouldn’t be any problem with the code you have shown. The problem may lie elsewhere.