Free memory when the pool is unowned.
(&mut self)
| 104 | impl Drop for PoolAlloc { |
| 105 | /// Free memory when the pool is unowned. |
| 106 | fn drop(&mut self) { |
| 107 | debug_assert!(self.bytes_used() == 0); // Do not free memory if still in-use. Not runtime check, because this should be statically impossible if this module is implemented correctly. |
| 108 | if let Some(bottom) = ptr::NonNull::new(self.bottom) { // May be null if the PoolAlloc was unused/unallocated. |
| 109 | let layout = Self::layout_u8(self.bytes_total()); // See also: c4e1285a-306a-450f-a027-13c0cd3d3d08 |
| 110 | unsafe { Global.dealloc(bottom, layout); } |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | impl Default for PoolAlloc { |
nothing calls this directly
no test coverage detected