Many memory leaks found in Boost Logger C++

I have a client/server app, I’m using Dr.Memory to debug and find mem leaks. The issue is that there are too many from the logger i’ve created for my application. Find the minimum reproducible example below –

Logger.hpp

#ifndef HORIZON_LOGGER_H
#define HORIZON_LOGGER_H

#include <cstring>
#include <atomic>
#include <mutex>

#define BOOST_LOG_DYN_LINK 0

#include <boost/log/core.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/sources/severity_logger.hpp>
#include <boost/log/expressions.hpp>
#include <boost/log/sinks/text_file_backend.hpp>
#include <boost/log/utility/setup/file.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>

class Logger
{
private:
    typedef boost::log::sources::severity_logger<boost::log::trivial::severity_level> logtype;

public:
    Logger();
    ~Logger();

    static Logger *getInstance()
    {
        static Logger instance;

        if (!instance._initialized)
            instance.initialize();
        
        return &instance;
    }

    void initialize();
    
    logtype &get_core_log() { return _core_log; }
    
    void colored_formatter(boost::log::record_view const& rec, boost::log::formatting_ostream& strm);
    std::string color(uint16_t color);

protected:
    logtype _core_log;
    std::atomic<bool> _initialized;

};

#define HLog(type) BOOST_LOG_TRIVIAL(Logger().getInstance()->get_core_log(), boost::log::trivial::type)

#endif //HORIZON_LOGGER_H

Logger.cpp

#include "Logger.hpp"
#include <iostream>
#include <boost/log/utility/setup/file.hpp>
#include <boost/log/expressions.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/log/support/date_time.hpp>
#include <boost/log/utility/setup/console.hpp>

Logger::Logger()
{
}

Logger::~Logger()
{
    //
}

std::string Logger::color(uint16_t color) { return "33[" + std::to_string(color) + "m"; }
 
void Logger::colored_formatter(boost::log::record_view const& rec, boost::log::formatting_ostream& strm)
{
    static auto date_time_formatter = boost::log::expressions::stream << boost::log::expressions::format_date_time<boost::posix_time::ptime >("TimeStamp", "%Y-%m-%d %H:%M:%S.%f");

    strm << "[";
    date_time_formatter(rec, strm);
    strm << "] [";

    auto severity = rec[boost::log::trivial::severity];

    switch (*severity) {
        case boost::log::trivial::trace:
        case boost::log::trivial::debug:
            strm << color(90);
        break;
        case boost::log::trivial::info:
            strm << color(36);
        break;
        case boost::log::trivial::warning:
            strm << color(33);
        break;
        case boost::log::trivial::error:
        case boost::log::trivial::fatal:
            strm << color(31);
        break;
        default:
        break;
    }

    strm << severity << color(0) << "]  " << rec[boost::log::expressions::message];
}

void Logger::initialize()
{
    /* init boost log 
     * 1. Add common attributes
     * 2. set log filter to trace
     */
    boost::log::add_common_attributes();
    
    boost::log::core::get()->add_global_attribute("Scope",
        boost::log::attributes::named_scope());
    
    boost::log::core::get()->set_filter(
        boost::log::trivial::severity >= boost::log::trivial::trace
    );

    /* log formatter:
     * [TimeStamp] [Severity Level] Log message
     */
    auto fmtTimeStamp = boost::log::expressions::
        format_date_time<boost::posix_time::ptime>("TimeStamp", "%Y-%m-%d %H:%M:%S.%f");
    
    auto fmtSeverity = boost::log::expressions::
        attr<boost::log::trivial::severity_level>("Severity");
    
    auto fmtScope = boost::log::expressions::format_named_scope("Scope",
        boost::log::keywords::format = "%n(%f:%l)",
        boost::log::keywords::iteration = boost::log::expressions::reverse,
        boost::log::keywords::depth = 2);
    
    boost::log::formatter logFmt =
        boost::log::expressions::format("[%1%] (%2%) %3%")
        % fmtTimeStamp % fmtSeverity
        % boost::log::expressions::smessage;

    /* console sink */
    auto consoleSink = boost::log::add_console_log(std::clog);
    
    consoleSink->set_formatter(std::bind(&Logger::colored_formatter, this, std::placeholders::_1, std::placeholders::_2));

    /* fs sink */
    auto fsSink = boost::log::add_file_log(
        boost::log::keywords::target = "logs",
        boost::log::keywords::file_name = "logs/log_%Y-%m-%d_%H-%M-%S.%N.log",
        boost::log::keywords::rotation_size = 10 * 1024 * 1024,
        boost::log::keywords::min_free_space = 30 * 1024 * 1024,
        boost::log::keywords::open_mode = std::ios_base::app);
    
    fsSink->set_formatter(logFmt);
    
    fsSink->locked_backend()->auto_flush(true);

    _initialized.store(true);
}

These cause many leaks as shown below:

Error #26: LEAK 118 direct bytes 0x0000021f81ba0450-0x0000021f81ba04c6 + 0 indirect bytes
# 0 replace_malloc                                                             [D:adrmemorydrmemorycommonalloc_replace.c:2580]
# 1 boost_filesystem-vc143-mt-gd-x64!boost::filesystem::detail::path_algorithms::compare_v4+0x361a2  (0x00007ffd70318873 <boost_filesystem-vc143-mt-gd-x64+0x38873>)
# 2 boost_filesystem-vc143-mt-gd-x64!boost::filesystem::detail::path_algorithms::compare_v4+0x2752b  (0x00007ffd70309bfc <boost_filesystem-vc143-mt-gd-x64+0x29bfc>)
# 3 boost_filesystem-vc143-mt-gd-x64!boost::filesystem::detail::path_algorithms::compare_v4+0x2a4cb  (0x00007ffd7030cb9c <boost_filesystem-vc143-mt-gd-x64+0x2cb9c>)
# 4 boost_filesystem-vc143-mt-gd-x64!boost::filesystem::detail::path_algorithms::compare_v4+0x15627  (0x00007ffd702f7cf8 <boost_filesystem-vc143-mt-gd-x64+0x17cf8>)
# 5 boost_log-vc143-mt-gd-x64-1_84.d!boost::filesystem::absolute               [C:vcpkginstalledx64-windowsincludeboostfilesystemoperations.hpp:367]
# 6 boost_log-vc143-mt-gd-x64-1_84.d!boost::log::v2_mt_nt62::sinks::`anonymous namespace'::file_collector_repository::get_collector [C:vcpkgbuildtreesboost-logsrcost-1.84.0-de692694bc.cleansrctext_file_backend.cpp:1064]
# 7 boost_log-vc143-mt-gd-x64-1_84.d!boost::log::v2_mt_nt62::sinks::file::aux::make_collector [C:vcpkgbuildtreesboost-logsrcost-1.84.0-de692694bc.cleansrctext_file_backend.cpp:1115]
# 8 boost::log::v2_mt_nt62::sinks::file::aux::make_collector<>                 [C:vcpkginstalledx64-windowsincludeboostlogsinkstext_file_backend.hpp:167]
# 9 boost::log::v2_mt_nt62::aux::file_name_param_traits<>::wrap_add_file_log<> [C:vcpkginstalledx64-windowsincludeboostlogutilitysetupfile.hpp:116]
#10 boost::log::v2_mt_nt62::add_file_log<>                                     [C:vcpkginstalledx64-windowsincludeboostlogutilitysetupfile.hpp:150]
#11 Logger::initialize                                                         [C:UsersSagun KhoslaDesktopReposhorizonsrcCoreLoggingLogger.cpp:119]

Invalid Heap Argument

Error #1: INVALID HEAP ARGUMENT to free 0x0000021f81b9fae0
# 0 replace_operator_delete_nothrow                                            [D:adrmemorydrmemorycommonalloc_replace.c:2978]
# 1 boost_log-vc143-mt-gd-x64-1_84.d!operator delete                           [D:a_work1ssrcvctoolscrtvcstartupsrcheapdelete_scalar_size.cpp:31]
# 2 boost_log-vc143-mt-gd-x64-1_84.d!boost::filesystem::path::~path  
# 3 boost_log-vc143-mt-gd-x64-1_84.d!boost::log::v2_mt_nt62::sinks::text_file_backend::set_file_name_pattern_internal [C:vcpkgbuildtreesboost-logsrcost-1.84.0-de692694bc.cleansrctext_file_backend.cpp:1575]
# 4 boost_log-vc143-mt-gd-x64-1_84.d!boost::log::v2_mt_nt62::sinks::text_file_backend::construct [C:vcpkgbuildtreesboost-logsrcost-1.84.0-de692694bc.cleansrctext_file_backend.cpp:1368]
# 5 boost::log::v2_mt_nt62::sinks::text_file_backend::construct<>              [C:vcpkginstalledx64-windowsincludeboostlogsinkstext_file_backend.hpp:599]
# 6 boost::log::v2_mt_nt62::aux::add_file_log<>                                [C:vcpkginstalledx64-windowsincludeboostlogutilitysetupfile.hpp:80]
# 7 boost::log::v2_mt_nt62::aux::file_name_param_traits<>::wrap_add_file_log<> [C:vcpkginstalledx64-windowsincludeboostlogutilitysetupfile.hpp:116]
# 8 boost::log::v2_mt_nt62::add_file_log<>                                     [C:vcpkginstalledx64-windowsincludeboostlogutilitysetupfile.hpp:150]
# 9 Logger::initialize                                                         [C:UsersSagun KhoslaDesktopReposhorizonsrcCoreLoggingLogger.cpp:119]
#10 Logger::getInstance                                                        [C:UsersSagun KhoslaDesktopReposhorizonsrcCoreLoggingLogger.hpp:54]
#11 Server::Server                                                             [C:UsersSagun KhoslaDesktopReposhorizonsrcServerCommonServer.cpp:213]
#12 Horizon::Zone::ZoneMainframe::ZoneMainframe                                [C:UsersSagun KhoslaDesktopReposhorizonsrcServerZoneZone.cpp:39]
#13 ZoneSystemTest_invoker                                                     [C:UsersSagun KhoslaDesktopReposhorizonsrcTestsZoneSystemTest.cpp:53]
#14 boost::detail::forward::operator()                                         [C:vcpkginstalledx64-windowsincludeboosttestimplexecution_monitor.ipp:1405]
#15 boost::detail::function::function_obj_invoker0<>::invoke                   [C:vcpkginstalledx64-windowsincludeboostfunctionfunction_template.hpp:137]
#16 boost::detail::do_invoke<>                                                 [C:vcpkginstalledx64-windowsincludeboosttestimplexecution_monitor.ipp:318]
#17 boost::execution_monitor::catch_signals                                    [C:vcpkginstalledx64-windowsincludeboosttestimplexecution_monitor.ipp:1236]
#18 boost::execution_monitor::execute                                          [C:vcpkginstalledx64-windowsincludeboosttestimplexecution_monitor.ipp:1318]
#19 boost::execution_monitor::vexecute                                         [C:vcpkginstalledx64-windowsincludeboosttestimplexecution_monitor.ipp:1414]
Note: @0:00:12.766 in thread 30180
Note: refers to -1 byte(s) before next malloc
Note: next higher malloc: 0x0000021f81b9fae0-0x0000021f81b9fb30
Note: refers to -80 byte(s) beyond last valid byte in prior malloc
Note: prev lower malloc:  0x0000021f81b9fae0-0x0000021f81b9fb30

What can I do to rid of these bugs?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật