Skip to content

Commit 12e069a

Browse files
committed
Enable memory profiling by default
`lg_prof_sample` is set to 23 and hopefully performance impact is minimal. Benchmark is not showing anything. If this causes any issues, it can still be overwritten by setting `MALLOC_CONF` env var on the command line.
1 parent e1c5ea8 commit 12e069a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

aptos-node/src/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
// Copyright (c) Aptos Foundation
22
// Licensed pursuant to the Innovation-Enabling Source Code License, available at https://github.com/aptos-labs/aptos-core/blob/main/LICENSE
33

4-
#![forbid(unsafe_code)]
5-
64
use aptos_node::{utils::ERROR_MSG_BAD_FEATURE_FLAGS, AptosNodeArgs};
75
use clap::Parser;
86

97
#[cfg(unix)]
108
#[global_allocator]
119
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
1210

11+
/// Can be overridden by setting the `MALLOC_CONF` env var.
12+
#[cfg(unix)]
13+
#[unsafe(no_mangle)]
14+
static malloc_conf: &[u8] = b"prof:true,lg_prof_sample:23\0";
15+
1316
fn main() {
1417
// Check that we are not including any Move test natives
1518
aptos_vm::natives::assert_no_test_natives(ERROR_MSG_BAD_FEATURE_FLAGS);

execution/executor-benchmark/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ use std::{
5252
#[global_allocator]
5353
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
5454

55+
#[cfg(unix)]
56+
#[unsafe(no_mangle)]
57+
static malloc_conf: &[u8] = b"prof:true,lg_prof_sample:23\0";
58+
5559
/// This is needed for filters on the Grafana dashboard working as its used to populate the filter
5660
/// variables.
5761
pub static START_TIME: Lazy<IntGauge> =

0 commit comments

Comments
 (0)