Struct webkit6::MemoryPressureSettings
source · pub struct MemoryPressureSettings { /* private fields */ }
Expand description
A boxed type representing the settings for the memory pressure handler
#WebKitMemoryPressureSettings is a boxed type that can be used to provide some custom settings to control how the memory pressure situations are handled by the different processes.
The memory pressure system implemented inside the different process will try to keep the memory usage under the defined memory limit. In order to do that, it will check the used memory with a user defined frequency and decide whether it should try to release memory. The thresholds passed will define how urgent is to release that memory.
Take into account that badly defined parameters can greatly reduce the performance of the engine. For example, setting memory limit too low with a fast poll interval can cause the process to constantly be trying to release memory.
A #WebKitMemoryPressureSettings can be passed to a #WebKitWebContext constructor, and the settings will be applied to all the web processes created by that context.
A #WebKitMemoryPressureSettings can be passed to webkit_website_data_manager_set_memory_pressure_settings(), and the settings will be applied to all the network processes created after that call by any instance of #WebKitWebsiteDataManager.
GLib type: Boxed type with copy-on-clone semantics.
Implementations§
source§impl MemoryPressureSettings
impl MemoryPressureSettings
sourcepub fn as_ptr(&self) -> *mut WebKitMemoryPressureSettings
pub fn as_ptr(&self) -> *mut WebKitMemoryPressureSettings
Return the inner pointer to the underlying C value.
sourcepub unsafe fn from_glib_ptr_borrow(
ptr: &*mut WebKitMemoryPressureSettings,
) -> &Self
pub unsafe fn from_glib_ptr_borrow( ptr: &*mut WebKitMemoryPressureSettings, ) -> &Self
Borrows the underlying C value.
sourcepub unsafe fn from_glib_ptr_borrow_mut(
ptr: &mut *mut WebKitMemoryPressureSettings,
) -> &mut Self
pub unsafe fn from_glib_ptr_borrow_mut( ptr: &mut *mut WebKitMemoryPressureSettings, ) -> &mut Self
Borrows the underlying C value mutably.
source§impl MemoryPressureSettings
impl MemoryPressureSettings
sourcepub fn new() -> MemoryPressureSettings
pub fn new() -> MemoryPressureSettings
Create a new #WebKitMemoryPressureSettings with the default values.
§Returns
A new #WebKitMemoryPressureSettings instance filled with the default values.
sourcepub fn conservative_threshold(&mut self) -> f64
pub fn conservative_threshold(&mut self) -> f64
sourcepub fn kill_threshold(&mut self) -> f64
pub fn kill_threshold(&mut self) -> f64
sourcepub fn memory_limit(&mut self) -> u32
pub fn memory_limit(&mut self) -> u32
sourcepub fn poll_interval(&mut self) -> f64
pub fn poll_interval(&mut self) -> f64
sourcepub fn strict_threshold(&mut self) -> f64
pub fn strict_threshold(&mut self) -> f64
sourcepub fn set_conservative_threshold(&mut self, value: f64)
pub fn set_conservative_threshold(&mut self, value: f64)
Sets the memory limit for the conservative policy to start working.
Sets @value as the fraction of the defined memory limit where the conservative policy starts working. This policy will try to reduce the memory footprint by releasing non critical memory.
The threshold must be bigger than 0 and smaller than 1, and it must be smaller than the strict threshold defined in @self. The default value is 0.33.
§value
fraction of the memory limit where the conservative policy starts working.
sourcepub fn set_kill_threshold(&mut self, value: f64)
pub fn set_kill_threshold(&mut self, value: f64)
Sets @value as the fraction of the defined memory limit where the process will be killed.
The threshold must be a value bigger or equal to 0. A value of 0 means that the process is never killed. If the threshold is not 0, then it must be bigger than the strict threshold defined in @self. The threshold can also have values bigger than 1. The default value is 0.
§value
fraction of the memory limit where the process will be killed because of excessive memory usage.
sourcepub fn set_memory_limit(&mut self, memory_limit: u32)
pub fn set_memory_limit(&mut self, memory_limit: u32)
Sets @memory_limit the memory limit value to @self.
The default value is the system’s RAM size with a maximum of 3GB.
§memory_limit
amount of memory (in MB) that the process is allowed to use.
sourcepub fn set_poll_interval(&mut self, value: f64)
pub fn set_poll_interval(&mut self, value: f64)
Sets @value as the poll interval used by @self.
The poll interval value must be bigger than 0. The default value is 30 seconds.
§value
period (in seconds) between memory usage measurements.
sourcepub fn set_strict_threshold(&mut self, value: f64)
pub fn set_strict_threshold(&mut self, value: f64)
Sets the memory limit for the strict policy to start working.
Sets @value as the fraction of the defined memory limit where the strict policy starts working. This policy will try to reduce the memory footprint by releasing critical memory.
The threshold must be bigger than 0 and smaller than 1. Also, it must be bigger than the conservative threshold defined in @self, and smaller than the kill threshold if the latter is not 0. The default value is 0.5.
§value
fraction of the memory limit where the strict policy starts working.
Trait Implementations§
source§impl Clone for MemoryPressureSettings
impl Clone for MemoryPressureSettings
source§impl Debug for MemoryPressureSettings
impl Debug for MemoryPressureSettings
source§impl Default for MemoryPressureSettings
impl Default for MemoryPressureSettings
source§impl From<MemoryPressureSettings> for Value
impl From<MemoryPressureSettings> for Value
source§fn from(o: MemoryPressureSettings) -> Self
fn from(o: MemoryPressureSettings) -> Self
source§impl HasParamSpec for MemoryPressureSettings
impl HasParamSpec for MemoryPressureSettings
type ParamSpec = ParamSpecBoxed
§type SetValue = MemoryPressureSettings
type SetValue = MemoryPressureSettings
type BuilderFn = fn(_: &str) -> ParamSpecBoxedBuilder<'_, MemoryPressureSettings>
fn param_spec_builder() -> Self::BuilderFn
source§impl Hash for MemoryPressureSettings
impl Hash for MemoryPressureSettings
source§impl Ord for MemoryPressureSettings
impl Ord for MemoryPressureSettings
source§fn cmp(&self, other: &MemoryPressureSettings) -> Ordering
fn cmp(&self, other: &MemoryPressureSettings) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for MemoryPressureSettings
impl PartialEq for MemoryPressureSettings
source§fn eq(&self, other: &MemoryPressureSettings) -> bool
fn eq(&self, other: &MemoryPressureSettings) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for MemoryPressureSettings
impl PartialOrd for MemoryPressureSettings
source§fn partial_cmp(&self, other: &MemoryPressureSettings) -> Option<Ordering>
fn partial_cmp(&self, other: &MemoryPressureSettings) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl StaticType for MemoryPressureSettings
impl StaticType for MemoryPressureSettings
source§fn static_type() -> Type
fn static_type() -> Type
Self
.impl Eq for MemoryPressureSettings
impl StructuralPartialEq for MemoryPressureSettings
Auto Trait Implementations§
impl Freeze for MemoryPressureSettings
impl RefUnwindSafe for MemoryPressureSettings
impl !Send for MemoryPressureSettings
impl !Sync for MemoryPressureSettings
impl Unpin for MemoryPressureSettings
impl UnwindSafe for MemoryPressureSettings
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)