diff --git a/daemon/main.c b/daemon/main.c
index 39af6abb3359d5d54cd0b2003d206c3226e83ad1..06b61115e7a5e115f0cc3809596267f8dd60587c 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -19,6 +19,7 @@
 #include <getopt.h>
 #include <uv.h>
 #include <libknot/internal/sockaddr.h>
+#include <ucw/mempool.h>
 
 #include "lib/defines.h"
 #include "lib/resolve.h"
@@ -128,8 +129,10 @@ int main(int argc, char **argv)
 	uv_signal_start(&sigint, signal_handler, SIGINT);
 
 	/* Create a server engine. */
-	mm_ctx_t pool;
-	mm_ctx_mempool(&pool, MM_DEFAULT_BLKSIZE);
+	mm_ctx_t pool = {
+		.ctx = mp_new (4096),
+		.alloc = (mm_alloc_t) mp_alloc
+	};
 	struct engine engine;
 	ret = engine_init(&engine, &pool);
 	if (ret != 0) {
diff --git a/daemon/worker.c b/daemon/worker.c
index 4bc787b167116e6ddabc7a2ded1eaca4b4c48bd4..c76c6fa32fd54670dfed49de00703d83605189ce 100644
--- a/daemon/worker.c
+++ b/daemon/worker.c
@@ -17,7 +17,7 @@
 #include <uv.h>
 #include <libknot/packet/pkt.h>
 #include <libknot/internal/net.h>
-#include <libknot/internal/mempool.h>
+#include <ucw/mempool.h>
 
 #include "daemon/worker.h"
 #include "daemon/engine.h"
@@ -62,8 +62,10 @@ static int parse_query(knot_pkt_t *query)
 
 static struct qr_task *qr_task_create(struct worker_ctx *worker, uv_handle_t *handle, knot_pkt_t *query, const struct sockaddr *addr)
 {
-	mm_ctx_t pool;
-	mm_ctx_mempool(&pool, MM_DEFAULT_BLKSIZE);
+	mm_ctx_t pool = {
+		.ctx = mp_new (4096),
+		.alloc = (mm_alloc_t) mp_alloc
+	};
 
 	/* Create worker task */
 	struct engine *engine = worker->engine;
diff --git a/lib/lib.mk b/lib/lib.mk
index 857d20fd851490507ae572aa9ff2ecbf649f1e39..41067c7ec593a0d8045447bfd6f6b66f2960d1b2 100644
--- a/lib/lib.mk
+++ b/lib/lib.mk
@@ -1,6 +1,7 @@
 ccan_EMBED := \
 	contrib/ccan/ilog/ilog.c \
 	contrib/ccan/isaac/isaac.c \
+	contrib/ucw/mempool.c \
 	contrib/murmurhash3/murmurhash3.c
 
 libkres_SOURCES := \
diff --git a/lib/resolve.c b/lib/resolve.c
index 409a378e5d59e6e03322d95d8588830fc981582f..0bc3fbd995017192ab8882deee7d73ce540e9ec2 100644
--- a/lib/resolve.c
+++ b/lib/resolve.c
@@ -16,12 +16,10 @@
 
 #include <stdio.h>
 #include <fcntl.h>
-
-#include <libknot/internal/mempool.h>
 #include <libknot/rrtype/rdname.h>
 #include <libknot/descriptor.h>
 #include <libknot/internal/net.h>
-
+#include <ucw/mempool.h>
 #include "lib/resolve.h"
 #include "lib/layer.h"
 #include "lib/rplan.h"
@@ -265,8 +263,10 @@ int kr_resolve(struct kr_context* ctx, knot_pkt_t *answer,
 	}
 
 	/* Create memory pool */
-	mm_ctx_t pool;
-	mm_ctx_mempool(&pool, MM_DEFAULT_BLKSIZE);
+	mm_ctx_t pool = {
+		.ctx = mp_new (KNOT_WIRE_MAX_PKTSIZE),
+		.alloc = (mm_alloc_t) mp_alloc
+	};
 	knot_pkt_t *query = knot_pkt_new(NULL, KNOT_EDNS_MAX_UDP_PAYLOAD, &pool);
 	knot_pkt_t *resp = knot_pkt_new(NULL, KNOT_WIRE_MAX_PKTSIZE, &pool);
 	if (!query || !resp) {
diff --git a/lib/resolve.h b/lib/resolve.h
index 7c1c66430f095af16cd9fff884b25e59ad070acb..3411f3fa050893e89cfeda67757c7a793b10d1c8 100644
--- a/lib/resolve.h
+++ b/lib/resolve.h
@@ -59,8 +59,12 @@
  * @code{.c}
  *
  * // Create request and its memory pool
- * struct kr_request req;
- * mm_ctx_mempool(&req.pool, 4096);
+ * struct kr_request req = {
+ * 	.pool = {
+ * 		.ctx = mp_new (4096),
+ * 		.alloc = (mm_alloc_t) mp_alloc
+ * 	}
+ * };
  * kr_resolve_begin(&req, ctx, answer);
  * int state = kr_resolve_query(&req, qname, qclass, qtype);
  *
diff --git a/modules/hints/hints.c b/modules/hints/hints.c
index 563131ab34c08157143ad7554ee85f5858aae3f9..8d42359480cf4dd34d8a317d50013f3399d71d1a 100644
--- a/modules/hints/hints.c
+++ b/modules/hints/hints.c
@@ -21,12 +21,12 @@
  * The module provides an override for queried address records.
  */
 
-#include <ccan/json/json.h>
 #include <libknot/packet/pkt.h>
 #include <libknot/descriptor.h>
 #include <libknot/internal/lists.h>
-#include <libknot/internal/mempool.h>
 #include <libknot/rrtype/aaaa.h>
+#include <ccan/json/json.h>
+#include <ucw/mempool.h>
 
 #include "lib/layer/iterate.h"
 #include "lib/zonecut.h"
@@ -171,8 +171,10 @@ static int load(struct kr_module *module, const char *path)
 	}
 
 	/* Create pool and copy itself */
-	mm_ctx_t _pool;
-	mm_ctx_mempool(&_pool, MM_DEFAULT_BLKSIZE);
+	mm_ctx_t _pool = {
+		.ctx = mp_new(4096),
+		.alloc = (mm_alloc_t) mp_alloc
+	};
 	mm_ctx_t *pool = mm_alloc(&_pool, sizeof(*pool));
 	if (!pool) {
 		return kr_error(ENOMEM);
diff --git a/tests/test_cache.c b/tests/test_cache.c
index f72a69a7a4f35c3d1578bcb0c94245428fe07822..b94fc660fa12e90e9b5a46f39fd3e086281a2520 100644
--- a/tests/test_cache.c
+++ b/tests/test_cache.c
@@ -14,8 +14,8 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <libknot/internal/mempool.h>
 #include <libknot/internal/namedb/namedb_lmdb.h>
+#include <ucw/mempool.h>
 
 #include "tests/test.h"
 #include "lib/cache.h"