Function rustacuda::memory::cuda_free[][src]

pub unsafe fn cuda_free<T>(p: DevicePointer<T>) -> CudaResult<()>
Expand description

Free memory allocated with cuda_malloc.

Errors

If freeing memory fails, returns the CUDA error value. If the given pointer is null, returns InvalidValue.

Safety

The given pointer must have been allocated with cuda_malloc, or null. The caller is responsible for ensuring that no other pointers to the deallocated buffer exist.

Examples

use rustacuda::memory::*;
unsafe {
    let device_buffer = cuda_malloc::<u64>(5).unwrap();
    // Free allocated memory.
    cuda_free(device_buffer).unwrap();
}