From a4eaafce9a243443a709037ef4b539e957396e61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Mon, 22 Oct 2018 21:23:19 +0200 Subject: [PATCH] Avoid GC allocation in StaticTaskPool. --- source/eventcore/drivers/threadedfile.d | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/eventcore/drivers/threadedfile.d b/source/eventcore/drivers/threadedfile.d index e2fcfb2..13dbe1a 100644 --- a/source/eventcore/drivers/threadedfile.d +++ b/source/eventcore/drivers/threadedfile.d @@ -421,10 +421,10 @@ private struct StaticTaskPool { if (!m_refCount++) { try { - m_pool = new TaskPool(4); + m_pool = mallocT!TaskPool(4); m_pool.isDaemon = true; } catch (Exception e) { - assert(false, "Failed to create file thread pool: "~e.msg); + assert(false, e.msg); } } @@ -447,8 +447,10 @@ private struct StaticTaskPool { if (fin_pool) { log("finishing thread pool"); - try fin_pool.finish(); - catch (Exception e) { + try { + fin_pool.finish(true); + freeT(fin_pool); + } catch (Exception e) { //log("Failed to shut down file I/O thread pool."); } }