Memory Leak in CUDA 3.0

Hello, I was wondering if anyone can help me with the following…

Using CUDA 3.0 (nvcc Release 3.0 V0.2.1221) under Ubuntu 10.04 (64-bit) with gcc 4.3, valgrind is reporting memory leaks.

Example code:

[codebox]#include <cuda_runtime_api.h>

int main()

{

int * host_array = new int [100];

for(int i=0; i<100; i++)

	host_array[i]=i;



int * dev_array = 0;

cudaMalloc((void**)&dev_array,100*sizeof(int));

cudaMemcpy(dev_array,host_array,100*sizeof(int),cudaMemcpyHo

stToDevice);

cudaFree(dev_array);

delete host_array;

return 0;

}[/codebox]

Compiling this with “nvcc memtest.cpp -o memtest.exe -g” and then running “valgrind ./memtest.exe --leak-check=full --track-origins=yes” I get:

Can anyone advise me as to whether I’m doing anything wrong or whether this is a bug in CUDA 3.0?

If the former, what am I doing wrong? If the latter, is there, or will there be, a fix?

Many thanks for your time,

Ralph

P.S. I get similar valgrind output when running the example program MonteCarloMultiGPU through valgrind.