MCPcopy Create free account
hub / github.com/That3Percent/second-stack / drop

Method drop

src/lib.rs:106–112  ·  view source on GitHub ↗

Free memory when the pool is unowned.

(&mut self)

Source from the content-addressed store, hash-verified

104impl 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
115impl Default for PoolAlloc {

Callers

nothing calls this directly

Calls 2

bytes_totalMethod · 0.80
releaseMethod · 0.80

Tested by

no test coverage detected