Question

I'm using C# with managedCuda lib. I allocate Memory on the GPU with this command: CudaDeviceVariable name = new CudaDeviceVariable(length); and it works fine. But I can not find the command to free it from the GPU.

thank you in advance =)

Was it helpful?

Solution

Use name.Dispose(); - CudaDeviceVariable is an IDisposable.

This also means you can use this handy syntax:

using (var name = new CudaDeviceVariable(length))
{
  // do the work
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top