Enqueues an operation to free the memory backed by this [`DeviceBuffer`] on a particular stream. The stream will free the allocation as soon as it reaches the operation in the stream. You can ensure the memory is freed by synchronizing the stream. This function uses internal memory pool semantics. Async allocations will reserve memory in the default memory pool in the stream, and async frees will
(self, stream: &Stream)
| 114 | /// # } |
| 115 | /// ``` |
| 116 | pub fn drop_async(self, stream: &Stream) -> CudaResult<()> { |
| 117 | if self.buf.is_null() { |
| 118 | return Ok(()); |
| 119 | } |
| 120 | // make sure we dont run the normal destructor, otherwise a double drop will happen |
| 121 | let me = ManuallyDrop::new(self); |
| 122 | // SAFETY: we consume the box so its not possible to use the box past its drop point unless |
| 123 | // you keep around a pointer, but in that case, we cannot guarantee safety. |
| 124 | unsafe { cuda_free_async(stream, me.buf) } |
| 125 | } |
| 126 | |
| 127 | /// Creates a `DeviceBuffer<T>` directly from the raw components of another device buffer. |
| 128 | /// |
nothing calls this directly
no test coverage detected