Struct jemalloc_ctl::thread::DeallocatedP
[−]
[src]
pub struct DeallocatedP(_);
A type providing access to the total number of bytes deallocated by the current thread.
The get
method doesn't return the value directly, but actually a pointer to the value. This
allows for very fast repeated lookup, since there is no function call overhead. The pointer type
cannot be sent to other threads, but DeallocatedP::get
can be called on different threads and
will return the appropriate pointer for each of them.
Example
use jemalloc_ctl::thread::DeallocatedP; let deallocated = DeallocatedP::new().unwrap(); let deallocated = deallocated.get().unwrap(); let a = deallocated.get(); let buf = vec![0; 1024 * 1024]; let b = deallocated.get(); drop(buf); let c = deallocated.get(); assert_eq!(a, b); assert!(b < c);
Methods
impl DeallocatedP
[src]
pub fn new() -> Result<DeallocatedP>
[src]
Returns a new Deallocated
.
pub fn get(&self) -> Result<ThreadLocal<u64>>
[src]
Returns a thread-local pointer to the total number of bytes deallocated by this thread.
Trait Implementations
impl Copy for DeallocatedP
[src]
impl Clone for DeallocatedP
[src]
fn clone(&self) -> DeallocatedP
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more