From 4afc0d16f072bb84173f6845f3c5d78b316082c8 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sun, 27 Aug 2023 20:46:19 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20=20refactor:=20add=20dhat?= =?UTF-8?q?=20profiler=20configuration=20with=20feat=20flag=20(#180)(#178)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bin/websurfx.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/bin/websurfx.rs b/src/bin/websurfx.rs index 75d0b8d..1f26af4 100644 --- a/src/bin/websurfx.rs +++ b/src/bin/websurfx.rs @@ -6,6 +6,11 @@ use std::net::TcpListener; use websurfx::{config::parser::Config, run}; +/// A dhat heap memory profiler +#[cfg(feature = "dhat-heap")] +#[global_allocator] +static ALLOC: dhat::Alloc = dhat::Alloc; + /// The function that launches the main server and registers all the routes of the website. /// /// # Error @@ -14,6 +19,10 @@ use websurfx::{config::parser::Config, run}; /// available for being used for other applications. #[actix_web::main] async fn main() -> std::io::Result<()> { + // A dhat heap profiler initialization. + #[cfg(feature = "dhat-heap")] + let _profiler = dhat::Profiler::new_heap(); + // Initialize the parsed config file. let config = Config::parse(false).unwrap();