Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feature for using jemalloc allocator. #1269

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ git = ["git2"] # Support indicating git modifications
paging = ["shell-words"] # Support applying a pager on the output
regex-onig = ["syntect/regex-onig"] # Use the "oniguruma" regex engine
regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine
allocator-jemalloc = ["jemallocator"] # Use jemalloc instead of the system allocator

[dependencies]
atty = { version = "0.2.14", optional = true }
Expand All @@ -51,6 +52,7 @@ serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.8"
semver = "0.11"
path_abs = { version = "0.5", default-features = false }
jemallocator = { version = "0.3.2", optional = true }

[dependencies.git2]
version = "0.13"
Expand Down
8 changes: 8 additions & 0 deletions src/bin/bat/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
// `error_chain!` can recurse deeply
#![recursion_limit = "1024"]

// jemalloc can be faster on certain platforms
#[cfg(feature = "allocator-jemalloc")]
use jemallocator::Jemalloc;

#[cfg(feature = "allocator-jemalloc")]
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;

mod app;
mod assets;
mod clap_app;
Expand Down