Я получаю следующий доступный блок в valgrind при использовании Boost Threadpool.Их еще много, но написание их здесь не будет служить цели.Ожидаются ли эти достижимые блоки?Есть ли способ исправить эти сообщения об ошибках?
8 bytes in 1 blocks are still reachable in loss record 1 of 20
==3163== at 0x4C27CC1: operator new(unsigned long) (vg_replace_malloc.c:261)
==3163== by 0x41BA30: boost::threadpool::detail::pool_core<boost::function0<void>, boost::threadpool::fifo_scheduler, boost::threadpool::static_size, boost::threadpool::resize_controller, boost::threadpool::wait_for_all_tasks>::pool_core() (pool_core.hpp:144)
==3163== by 0x41B2AC: boost::threadpool::thread_pool<boost::function0<void>, boost::threadpool::fifo_scheduler, boost::threadpool::static_size, boost::threadpool::resize_controller, boost::threadpool::wait_for_all_tasks>::thread_pool(unsigned long) (pool.hpp:101)
==3163== by 0x41A433: infrastructure::logger::InMemoryLoggerThreadPool::InitInMemoryLoggerThreadPool(long) (InMemoryLoggerThreadPool.cpp:20)
==3163== by 0x412E63: infrastructure::logger::tester_caller_0(int, char**) (main.cpp:89)
==3163== by 0x413245: main (main.cpp:138)
==3163==
Заголовочный файл:
#ifndef TRUNK_INFRASTRUCTURE_INCLUDE_INMEMORYLOGGER_INMEMORYLOGGERTHREADPOOL_H_
#define TRUNK_INFRASTRUCTURE_INCLUDE_INMEMORYLOGGER_INMEMORYLOGGERTHREADPOOL_H_
#include <assert.h>
#include <stdint.h>
#include "general_utility/include/TechnicalUtilities.h"
#include "third_party/include/boost/threadpool.hpp"
namespace infrastructure {
namespace logger {
class InMemoryLoggerThreadPool {
public:
InMemoryLoggerThreadPool() {}
~InMemoryLoggerThreadPool() {}
static void InitInMemoryLoggerThreadPool(int64_t number_of_threads);
static void ShutDownInMemoryLoggerThreadPool();
static inline void ScheduleTask(boost::threadpool::pool::task_type task) {
assert(in_memory_logger_pool__);
in_memory_logger_pool__->schedule(task);
}
static inline void AssertInitialization() {
assert(in_memory_logger_pool__);
}
private:
static boost::threadpool::pool* in_memory_logger_pool__;
DISALLOW_COPY_AND_ASSIGN(InMemoryLoggerThreadPool);
};
} // namespace logger
} // namespace infrastructure
Исходный файл:
#include "infrastructure/include/InMemoryLogger/InMemoryLoggerThreadPool.h"
namespace infrastructure {
namespace logger {
boost::threadpool::pool* InMemoryLoggerThreadPool::
in_memory_logger_pool__ = NULL;
void InMemoryLoggerThreadPool::InitInMemoryLoggerThreadPool(int64_t
number_of_threads) {
in_memory_logger_pool__ = new boost::threadpool::pool(number_of_threads);
}
void InMemoryLoggerThreadPool::ShutDownInMemoryLoggerThreadPool() {
in_memory_logger_pool__->wait(0);
delete in_memory_logger_pool__;
}
} // namespace logger
} // namespace infrastructure
Init вызывается в начале иотключение в конце основного