pub struct MemoryPressureSettings { /* private fields */ }Expand description
A boxed type representing the settings for the memory pressure handler
MemoryPressureSettings 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 MemoryPressureSettings can be passed to a WebContext constructor, and the settings will
be applied to all the web processes created by that context.
A MemoryPressureSettings 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
WebsiteDataManager.
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 MemoryPressureSettings with the default values.
§Returns
A new MemoryPressureSettings 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
Source§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§impl PartialOrd for MemoryPressureSettings
impl PartialOrd for MemoryPressureSettings
Source§impl StaticType for MemoryPressureSettings
impl StaticType for MemoryPressureSettings
Source§fn static_type() -> Type
fn static_type() -> Type
Self.