Skip to content

Commit

Permalink
Use mimalloc as the global memory allocator (#2723)
Browse files Browse the repository at this point in the history
* Experimenting with mimalloc as the global allocator for desktop

* Format toml file
  • Loading branch information
matheus-consoli authored Sep 25, 2024
1 parent 33da868 commit ab8832b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
24 changes: 22 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ image = "0.24.9" # Update bl
itertools = "0.13.0"
lending-stream = "1.0"
libc = "0.2"
mimalloc = "0.1.43"
normpath = "1.2"
once_cell = "1.19"
pin-project-lite = "0.2.14"
Expand Down
3 changes: 3 additions & 0 deletions apps/desktop/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ tauri-plugin-os = "=2.0.0-rc.0"
tauri-plugin-shell = "=2.0.0-rc.0"
tauri-plugin-updater = "=2.0.0-rc.0"

# memory allocator
mimalloc = { workspace = true }

[dependencies.tauri]
features = ["linux-libxdo", "macos-private-api", "native-tls-vendored", "unstable"]
version = "=2.0.0-rc.2"
Expand Down
3 changes: 3 additions & 0 deletions apps/desktop/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
windows_subsystem = "windows"
)]

#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

use std::{fs, path::PathBuf, process::Command, sync::Arc, time::Duration};

use menu::{set_enabled, MenuEvent};
Expand Down

0 comments on commit ab8832b

Please sign in to comment.