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

fix: only use jemalloc on linux #459

Merged
merged 1 commit into from
Jan 29, 2025
Merged
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
6 changes: 4 additions & 2 deletions bin/agent-data-plane/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ saluki-io = { workspace = true }
saluki-metadata = { workspace = true }
serde = { workspace = true }
stringtheory = { workspace = true }
tikv-jemalloc-ctl = { workspace = true, features = ["use_std"] }
tikv-jemallocator = { workspace = true, features = ["background_threads", "unprefixed_malloc_on_supported_platforms", "stats"] }
tokio = { workspace = true, features = ["macros", "rt", "rt-multi-thread", "signal"] }
tokio-rustls = { workspace = true }
tracing = { workspace = true }

[target.'cfg(target_os = "linux")'.dependencies]
tikv-jemalloc-ctl = { workspace = true, features = ["use_std"] }
tikv-jemallocator = { workspace = true, features = ["background_threads", "unprefixed_malloc_on_supported_platforms", "stats"] }

[build-dependencies]
chrono = { workspace = true }
18 changes: 9 additions & 9 deletions bin/agent-data-plane/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,24 @@ use saluki_env::EnvironmentProvider as _;
use saluki_error::{ErrorContext as _, GenericError};
use saluki_health::HealthRegistry;
use saluki_io::net::ListenAddress;
use tikv_jemallocator::Jemalloc;
use tokio::select;
use tracing::{debug, error, info, warn};
use tracing::{error, info, warn};

mod components;
use self::components::remapper::AgentTelemetryRemapperConfiguration;

mod env_provider;
use self::env_provider::ADPEnvironmentProvider;

#[cfg(target_os = "linux")]
#[global_allocator]
static ALLOC: memory_accounting::allocator::TrackingAllocator<Jemalloc> =
memory_accounting::allocator::TrackingAllocator::new(Jemalloc);
static ALLOC: memory_accounting::allocator::TrackingAllocator<tikv_jemallocator::Jemalloc> =
memory_accounting::allocator::TrackingAllocator::new(tikv_jemallocator::Jemalloc);

#[cfg(not(target_os = "linux"))]
#[global_allocator]
static ALLOC: memory_accounting::allocator::TrackingAllocator<std::alloc::System> =
memory_accounting::allocator::TrackingAllocator::new(std::alloc::System);

#[tokio::main]
async fn main() {
Expand Down Expand Up @@ -87,11 +92,6 @@ async fn run(started: Instant, logging_api_handler: LoggingAPIHandler) -> Result
"Agent Data Plane starting..."
);

debug!(
"Using jemalloc configuration: {}",
tikv_jemalloc_ctl::config::malloc_conf::mib().unwrap().read().unwrap()
);

// Load our configuration and create all high-level primitives (health registry, component registry, environment
// provider, etc) that are needed to build the topology.
let configuration = ConfigurationLoader::default()
Expand Down
Loading