2
0
mirror of https://github.com/boostorg/asio.git synced 2026-01-26 18:22:09 +00:00

Restore null pointer check for better performance.

This commit is contained in:
Christopher Kohlhoff
2020-11-02 12:47:56 +11:00
parent 18d17285c3
commit fc6400a1ef

View File

@@ -66,7 +66,13 @@ public:
~thread_info_base()
{
for (int i = 0; i < max_mem_index; ++i)
::operator delete(reusable_memory_[i]);
{
// The following test for non-null pointers is technically redundant, but
// it is significantly faster when using a tight io_context::poll() loop
// in latency sensitive applications.
if (reusable_memory_[i])
::operator delete(reusable_memory_[i]);
}
}
static void* allocate(thread_info_base* this_thread, std::size_t size)