mirror of
https://github.com/zhboner/realm.git
synced 2026-11-17 16:17:22 +00:00
add optional page-allocator
This commit is contained in:
Generated
+10
@@ -629,6 +629,15 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mmap-allocator"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f0d1de3adf2053ad56a86a2b35fd0e74d9a82eb6d204821a2186cc96cb6a6c7"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ntapi"
|
||||
version = "0.3.6"
|
||||
@@ -867,6 +876,7 @@ dependencies = [
|
||||
"jemallocator",
|
||||
"log",
|
||||
"mimalloc",
|
||||
"mmap-allocator",
|
||||
"realm_core",
|
||||
"realm_io 0.3.3",
|
||||
"realm_syscall 0.1.4",
|
||||
|
||||
@@ -53,6 +53,7 @@ mimalloc = { version = "0.1", optional = true }
|
||||
|
||||
[target.'cfg(not(target_env = "msvc"))'.dependencies]
|
||||
jemallocator = { version = "0.5", optional = true }
|
||||
mmap-allocator = { version = "0.3", optional = true }
|
||||
|
||||
|
||||
[dev-dependencies]
|
||||
@@ -70,6 +71,7 @@ multi-thread = ["tokio/rt-multi-thread"]
|
||||
brutal-shutdown = ["realm_io/brutal-shutdown"]
|
||||
jemalloc = ["jemallocator"]
|
||||
mi-malloc = ["mimalloc"]
|
||||
page-alloc = ["mmap-allocator"]
|
||||
|
||||
|
||||
[profile.release]
|
||||
|
||||
@@ -69,6 +69,7 @@ RUSTFLAGS='-C target_cpu=native' cargo build --release
|
||||
- multi-thread: enable tokio's multi-threaded IO scheduler.
|
||||
- mi-malloc: custom memory allocator.
|
||||
- jemalloc: custom memory allocator.
|
||||
- page-alloc: custom memory allocator.
|
||||
|
||||
Default: hook + proxy + balance + transport + multi-thread.
|
||||
|
||||
|
||||
+5
-1
@@ -9,7 +9,7 @@ use realm::relay;
|
||||
use realm::ENV_CONFIG;
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(all(feature = "mi-malloc"))] {
|
||||
if #[cfg(feature = "mi-malloc")] {
|
||||
use mimalloc::MiMalloc;
|
||||
#[global_allocator]
|
||||
static GLOBAL: MiMalloc = MiMalloc;
|
||||
@@ -17,6 +17,10 @@ cfg_if! {
|
||||
use jemallocator::Jemalloc;
|
||||
#[global_allocator]
|
||||
static GLOBAL: Jemalloc = Jemalloc;
|
||||
} else if #[cfg(all(feature = "page-alloc", unix))] {
|
||||
use mmap_allocator::MmapAllocator;
|
||||
#[global_allocator]
|
||||
static GLOBAL: MmapAllocator = MmapAllocator::new();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user