Frees the allocated memory region, which would be leaked otherwise. Likely to invalidate existing function pointers, causing unsafety.
(&mut self)
| 196 | /// Frees the allocated memory region, which would be leaked otherwise. |
| 197 | /// Likely to invalidate existing function pointers, causing unsafety. |
| 198 | pub(crate) unsafe fn free_memory(&mut self) { |
| 199 | if self.ptr == ptr::null_mut() { |
| 200 | return; |
| 201 | } |
| 202 | self.segments.clear(); |
| 203 | // Drop the allocation, freeing memory. |
| 204 | let _: Option<region::Allocation> = self.alloc.take(); |
| 205 | self.ptr = ptr::null_mut(); |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | impl Drop for ArenaMemoryProvider { |
no test coverage detected