Repository: EmbarkStudios/cargo-about (language: rust)

Issue:
Add support for aarch64-apple-darwin
Did a quick test build for it and seems the main issue is or rpmalloc crate which is lacking support (https://github.com/EmbarkStudios/rpmalloc-rs/issues/11). We could for now disable the custom global allocator for now for this target


Discussion / hints:
Just ran into this. Would you accept a PR that disables that dependency on aarch64-apple-darwin? I can prepare one tomorrow.
We probably should just switch to the [`mimalloc`](https://crates.io/crates/mimalloc) crate which we already use on on all targets (including `aarch64-apple-darwin`) in other projects.

A PR with that would be most welcome!
Oh, even easier. I can do that too!
Question though: why does this crate even _need_ a custom allocator? Is it that allocation-heavy that it really benefits much from a non-system one?
I think it was primarily to speed up `x86_64-unknown-linux-musl` since its allocator was pretty terrible wrt parallelization and it's easier to just use the same allocator for all targets (until we hit issues like this).
Yes I think that was the original issue, and maybe also that on Windows it was really slow with the system allocator that made an actual impact.

Fix patch:
diff --git a/Cargo.lock b/Cargo.lock
index bde9e17..3dc7144 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -169,8 +169,8 @@ dependencies = [
  "krates",
  "license",
  "log",
+ "mimalloc",
  "rayon",
- "rpmalloc",
  "serde",
  "serde_json",
  "smallvec",
@@ -533,6 +533,15 @@ version = "0.2.88"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "03b07a082330a35e43f63177cc01689da34fbffa0105e1246cf0311472cac73a"
 
+[[package]]
+name = "libmimalloc-sys"
+version = "0.1.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2396cf99d2f58611cd69f0efeee4af3d2e2c7b61bed433515029163aa567e65c"
+dependencies = [
+ "cc",
+]
+
 [[package]]
 name = "license"
 version = "1.1.10"
@@ -569,6 +578,15 @@ dependencies = [
  "autocfg",
 ]
 
+[[package]]
+name = "mimalloc"
+version = "0.1.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e7c6b11afd1e5e689ac96b6d18b1fc763398fe3d7eed99e8773426bc2033dfb"
+dependencies = [
+ "libmimalloc-sys",
+]
+
 [[package]]
 name = "miniz_oxide"
 version = "0.4.4"
@@ -679,12 +697,6 @@ dependencies = [
  "indexmap",
 ]
 
-[[package]]
-name = "pkg-config"
-version = "0.3.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
-
 [[package]]
 name = "proc-macro-error"
 version = "1.0.4"
@@ -796,26 +808,6 @@ dependencies = [
  "serde",
 ]
 
-[[package]]
-name = "rpmalloc"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8dae55d27fc56f399aec2583434bf22c7100fe983b2115bbc1d961ec4f7df5db"
-dependencies = [
- "rpmalloc-sys",
-]
-
-[[package]]
-name = "rpmalloc-sys"
-version = "0.2.1+1.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a3e9198b851305d2f4bf86353b98016d79b871158ea5f9d0756b84022aefb99"
-dependencies = [
- "cc",
- "libc",
- "pkg-config",
-]
-
 [[package]]
 name = "rustc-demangle"
 version = "0.1.18"
diff --git a/Cargo.toml b/Cargo.toml
index 5968ba3..422577d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -40,4 +40,4 @@ smallvec = "1.2"
 spdx = "0.3"
 structopt = "0.3"
 toml = "0.5"
-rpmalloc = "0.2"
+mimalloc = "0.1.25"
diff --git a/src/cargo-about/main.rs b/src/cargo-about/main.rs
index 5db9bae..f40ebd8 100644
--- a/src/cargo-about/main.rs
+++ b/src/cargo-about/main.rs
@@ -58,7 +58,7 @@ mod generate;
 mod init;
 
 #[global_allocator]
-static ALLOC: rpmalloc::RpMalloc = rpmalloc::RpMalloc;
+static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
 
 #[derive(StructOpt, Debug)]
 enum Command {


Test patch: