Free page-locked memory allocated with [`cuda_malloc_host`](fn.cuda_malloc_host.html). # 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. # Example
(ptr: *mut T)
| 280 | /// } |
| 281 | /// ``` |
| 282 | pub unsafe fn cuda_free_locked<T>(ptr: *mut T) -> CudaResult<()> { |
| 283 | if ptr.is_null() { |
| 284 | return Err(CudaError::InvalidMemoryAllocation); |
| 285 | } |
| 286 | |
| 287 | cuda::cuMemFreeHost(ptr as *mut c_void).to_result()?; |
| 288 | Ok(()) |
| 289 | } |
| 290 | |
| 291 | #[cfg(test)] |
| 292 | mod test { |