Fix mimalloc for hot reloading

This commit is contained in:
Isse 2022-07-04 10:08:27 +00:00
parent 53f885ff57
commit 16c5c657cc
4 changed files with 13 additions and 1 deletions

1
Cargo.lock generated
View File

@ -6778,6 +6778,7 @@ version = "0.10.0"
dependencies = [
"bytemuck",
"lazy_static",
"mimalloc",
"vek 0.15.8",
"veloren-common",
"veloren-voxygen-dynlib",

View File

@ -20,3 +20,6 @@ voxygen-dynlib = {package = "veloren-voxygen-dynlib", path = "../dynlib", option
# Hot Reloading
lazy_static = {version = "1.4.0", optional = true}
[target.'cfg(windows)'.dependencies]
mimalloc = "0.1.29"

View File

@ -4,6 +4,10 @@
#[cfg(all(feature = "be-dyn-lib", feature = "use-dyn-lib"))]
compile_error!("Can't use both \"be-dyn-lib\" and \"use-dyn-lib\" features at once");
#[cfg(all(target_os = "windows", feature = "be-dyn-lib"))]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
macro_rules! skeleton_impls {
{ struct $Skeleton:ident { $( $(+)? $bone:ident ),* $(,)? $(:: $($field:ident : $field_ty:ty),* $(,)? )? } } => {
#[derive(Clone, Default)]

View File

@ -2,7 +2,11 @@
#![feature(bool_to_option)]
#![recursion_limit = "2048"]
#[cfg(all(target_os = "windows", not(feature = "tracy-memory")))]
#[cfg(all(
target_os = "windows",
not(feature = "tracy-memory"),
not(feature = "hot-egui")
))]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;