Skip to content

Commit

Permalink
refactor(host): move allocator next to memory module
Browse files Browse the repository at this point in the history
  • Loading branch information
petarvujovic98 committed Jul 3, 2024
1 parent 7275c10 commit c045f3c
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions host/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ pub mod metrics;
pub mod proof;
pub mod server;

#[global_allocator]
static ALLOCATOR: Cap<alloc::System> = Cap::new(alloc::System, usize::MAX);

#[derive(Default, Clone, Serialize, Deserialize, Debug, Parser)]
#[command(
name = "raiko",
Expand Down Expand Up @@ -182,6 +179,9 @@ impl ProverState {
}
}

#[global_allocator]
static ALLOCATOR: Cap<alloc::System> = Cap::new(alloc::System, usize::MAX);

mod memory {
use tracing::debug;

Expand All @@ -197,10 +197,8 @@ mod memory {

pub(crate) fn print_stats(title: &str) {
let max_memory = get_max_allocated();
debug!(
"{title}{}.{:06} MB",
max_memory / 1_000_000,
max_memory % 1_000_000
);
let mbs = max_memory / 1_000_000;
let kbs = max_memory % 1_000_000;
debug!("{title}{mbs}.{kbs:06} MB");
}
}

0 comments on commit c045f3c

Please sign in to comment.