[][src]Function rustacuda::memory::cuda_free_unified

pub unsafe fn cuda_free_unified<T: DeviceCopy>(
    p: UnifiedPointer<T>
) -> CudaResult<()>

Free memory allocated with cuda_malloc_unified.

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_unified, or null. The caller is responsible for ensuring that no other pointers to the deallocated buffer exist.

Examples

use rustacuda::memory::*;
unsafe {
    let unified_buffer = cuda_malloc_unified::<u64>(5).unwrap();
    // Free allocated memory.
    cuda_free_unified(unified_buffer).unwrap();
}