Function rustacuda::memory::cuda_free_locked
source · pub unsafe fn cuda_free_locked<T>(ptr: *mut T) -> CudaResult<()>
Expand description
Free page-locked memory allocated with cuda_malloc_host
.
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_locked
, or null.
The caller is responsible for ensuring that no other pointers to the deallocated buffer exist.
Examples
use rustacuda::memory::*;
unsafe {
let locked_buffer = cuda_malloc_locked::<u64>(5).unwrap();
// Free allocated memory
cuda_free_locked(locked_buffer).unwrap();
}