Struct re_memory::MemoryLimit
source · pub struct MemoryLimit {
pub max_bytes: Option<i64>,
}
Expand description
Represents a limit in how much RAM to use for the entire process.
Different systems can chose to heed the memory limit in different ways, e.g. by dropping old data when it is exceeded.
It is recommended that they log using [re_log::info_once
] when they
drop data because a memory limit is reached.
Fields§
§max_bytes: Option<i64>
Limit in bytes.
This is primarily compared to what is reported by crate::AccountingAllocator
(‘counted’).
We limit based on this instead of resident
(RSS) because counted
is what we have immediate
control over, while RSS depends on what our allocator (MiMalloc) decides to do.
Implementations§
source§impl MemoryLimit
impl MemoryLimit
sourcepub fn from_bytes(max_bytes: u64) -> Self
pub fn from_bytes(max_bytes: u64) -> Self
Set the limit to some number of bytes.
sourcepub fn from_fraction_of_total(fraction: f32) -> Self
pub fn from_fraction_of_total(fraction: f32) -> Self
Set the limit to some fraction (0-1) of the total available RAM.
sourcepub fn parse(limit: &str) -> Result<Self, String>
pub fn parse(limit: &str) -> Result<Self, String>
The limit can either be absolute (e.g. “16GB”) or relative (e.g. “50%”).
pub fn is_limited(&self) -> bool
pub fn is_unlimited(&self) -> bool
sourcepub fn is_exceeded_by(&self, mem_use: &MemoryUse) -> Option<f32>
pub fn is_exceeded_by(&self, mem_use: &MemoryUse) -> Option<f32>
Returns how large fraction of memory we should free to go down to the exact limit.
Trait Implementations§
source§impl Clone for MemoryLimit
impl Clone for MemoryLimit
source§fn clone(&self) -> MemoryLimit
fn clone(&self) -> MemoryLimit
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MemoryLimit
impl Debug for MemoryLimit
source§impl PartialEq for MemoryLimit
impl PartialEq for MemoryLimit
source§fn eq(&self, other: &MemoryLimit) -> bool
fn eq(&self, other: &MemoryLimit) -> bool
self
and other
values to be equal, and is used
by ==
.impl Copy for MemoryLimit
impl Eq for MemoryLimit
impl StructuralPartialEq for MemoryLimit
Auto Trait Implementations§
impl Freeze for MemoryLimit
impl RefUnwindSafe for MemoryLimit
impl Send for MemoryLimit
impl Sync for MemoryLimit
impl Unpin for MemoryLimit
impl UnwindSafe for MemoryLimit
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more