From 3b467421ceda13ca90d764a1eea1626fbbd95bd9 Mon Sep 17 00:00:00 2001
From: Florian Schmaus <flow@cs.fau.de>
Date: Sun, 13 Feb 2022 11:21:11 +0100
Subject: [PATCH] [ContextManager] Do not pre-allocate contexts

---
 emper/ContextManager.cpp | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/emper/ContextManager.cpp b/emper/ContextManager.cpp
index 3f7291be..b76a3335 100644
--- a/emper/ContextManager.cpp
+++ b/emper/ContextManager.cpp
@@ -13,22 +13,11 @@
 #include "Emper.hpp"
 #include "Fibril.hpp"
 #include "Runtime.hpp"
-#include "emper-common.h"
 #include "emper-config.h"	 // // IWYU pragma: keep
 
 class AbstractFiber;
 
-ContextManager::ContextManager(Runtime& runtime) : MemoryManager(runtime), runtime(runtime) {
-	auto newWorkerHook = [this](ATTR_UNUSED workerid_t workerId) {
-		for (unsigned int i = 0; i < CONTEXT_MANAGER_FIRST_LAYER_QUEUE_SIZE * 2; ++i) {
-			auto* context = new Context(this->runtime.dispatcher.getDispatchLoop());
-			putFreeContext(context);
-		}
-	};
-	// Note that it is important that this hook is executed *after*
-	// the one of the MemoryManager superclass.
-	runtime.addNewWorkerHook(newWorkerHook);
-}
+ContextManager::ContextManager(Runtime& runtime) : MemoryManager(runtime), runtime(runtime) {}
 
 auto ContextManager::getFreeContext() -> Context* {
 	if constexpr (!emper::CONTEXT_MANAGER_WITH_MEMORY_MANAGER) {
-- 
GitLab