Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Remove incorrect proof about Jemalloc #3982

Merged
merged 3 commits into from
Oct 1, 2021
Merged
Changes from 2 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
38 changes: 28 additions & 10 deletions node/overseer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,18 +518,36 @@ where
}
let subsystem_meters = overseer.map_subsystems(ExtractNameAndMeters);

let memory_stats =
MemoryAllocationTracker::new().expect("Jemalloc is the default allocator. qed");

let metronome = Metronome::new(std::time::Duration::from_millis(950)).for_each(move |_| {
match memory_stats.snapshot() {
Ok(memory_stats_snapshot) => {
tracing::trace!(target: LOG_TARGET, "memory_stats: {:?}", &memory_stats_snapshot);
metronome_metrics.memory_stats_snapshot(memory_stats_snapshot);
let collect_memory_stats: Box<dyn Fn(&OverseerMetrics) + Send> =
match MemoryAllocationTracker::new() {
Ok(memory_stats) =>
Box::new(move |metrics: &OverseerMetrics| match memory_stats.snapshot() {
Ok(memory_stats_snapshot) => {
tracing::trace!(
target: LOG_TARGET,
"memory_stats: {:?}",
&memory_stats_snapshot
);
metrics.memory_stats_snapshot(memory_stats_snapshot);
},
Err(e) => tracing::debug!(
target: LOG_TARGET,
"Failed to obtain memory stats: {:?}",
e
),
}),
Err(_) => {
tracing::debug!(
target: LOG_TARGET,
"Jemalloc not set as allocator, so memory allocations will not be tracked",
Copy link
Member

@ordian ordian Oct 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe worth making the log message generic (as in #3893) if we're to add support for other allocators in the future, but your call :P

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you mean by making it generic?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not mentioned Jemalloc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh. I mean currently it is only supported for Jemalloc and will probably not change in the near future?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But yeah, I remove it

);

Box::new(|_| {})
},
};

Err(e) => tracing::debug!(target: LOG_TARGET, "Failed to obtain memory stats: {:?}", e),
}
let metronome = Metronome::new(std::time::Duration::from_millis(950)).for_each(move |_| {
collect_memory_stats(&metronome_metrics);

// We combine the amount of messages from subsystems to the overseer
// as well as the amount of messages from external sources to the overseer
Expand Down