fix: set M_MALLOC_THRESHOLD to prevent memory fragmentation
This commit is contained in:
parent
726c8288da
commit
8b4e2578ec
3 changed files with 10 additions and 1 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -1353,6 +1353,7 @@ dependencies = [
|
||||||
"cosmic-applet-time",
|
"cosmic-applet-time",
|
||||||
"cosmic-applet-workspaces",
|
"cosmic-applet-workspaces",
|
||||||
"cosmic-panel-button",
|
"cosmic-panel-button",
|
||||||
|
"libc",
|
||||||
"libcosmic",
|
"libcosmic",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-log",
|
"tracing-log",
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ cosmic-applet-time = { path = "../cosmic-applet-time" }
|
||||||
cosmic-applet-workspaces = { path = "../cosmic-applet-workspaces" }
|
cosmic-applet-workspaces = { path = "../cosmic-applet-workspaces" }
|
||||||
cosmic-applet-input-sources = { path = "../cosmic-applet-input-sources" }
|
cosmic-applet-input-sources = { path = "../cosmic-applet-input-sources" }
|
||||||
cosmic-panel-button = { path = "../cosmic-panel-button" }
|
cosmic-panel-button = { path = "../cosmic-panel-button" }
|
||||||
|
libc = "0.2"
|
||||||
libcosmic.workspace = true
|
libcosmic.workspace = true
|
||||||
tracing.workspace = true
|
tracing.workspace = true
|
||||||
tracing-subscriber.workspace = true
|
tracing-subscriber.workspace = true
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,13 @@
|
||||||
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
fn main() -> cosmic::iced::Result {
|
fn main() -> cosmic::iced::Result {
|
||||||
|
// Prevents glibc from hoarding memory, such as cosmic-applet-minimize
|
||||||
|
// consuming 100s of megabytes on restoring a minimized window.
|
||||||
|
#[cfg(target_env = "gnu")]
|
||||||
|
unsafe {
|
||||||
|
libc::mallopt(libc::M_MMAP_THRESHOLD, 65536);
|
||||||
|
}
|
||||||
|
|
||||||
tracing_subscriber::fmt().with_env_filter("warn").init();
|
tracing_subscriber::fmt().with_env_filter("warn").init();
|
||||||
let _ = tracing_log::LogTracer::init();
|
let _ = tracing_log::LogTracer::init();
|
||||||
|
|
||||||
|
|
@ -32,6 +39,6 @@ fn main() -> cosmic::iced::Result {
|
||||||
"cosmic-applet-workspaces" => cosmic_applet_workspaces::run(),
|
"cosmic-applet-workspaces" => cosmic_applet_workspaces::run(),
|
||||||
"cosmic-applet-input-sources" => cosmic_applet_input_sources::run(),
|
"cosmic-applet-input-sources" => cosmic_applet_input_sources::run(),
|
||||||
"cosmic-panel-button" => cosmic_panel_button::run(),
|
"cosmic-panel-button" => cosmic_panel_button::run(),
|
||||||
_ => return Ok(()),
|
_ => Ok(()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue