From 7ff0a265a8b5692268c0f44385712c7be8e32775 Mon Sep 17 00:00:00 2001 From: Klement Sekera Date: Mon, 3 Sep 2018 12:35:27 +0200 Subject: vapi: init clib mem heap on connect if needed Change-Id: Id45a3a37dd77771289622314406dccf50b64f04d Signed-off-by: Klement Sekera --- src/vpp-api/vapi/vapi.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/vpp-api') diff --git a/src/vpp-api/vapi/vapi.c b/src/vpp-api/vapi/vapi.c index 1a0fdbb627a..70382d17bbb 100644 --- a/src/vpp-api/vapi/vapi.c +++ b/src/vpp-api/vapi/vapi.c @@ -306,6 +306,10 @@ vapi_connect (vapi_ctx_t ctx, const char *name, { return VAPI_EINVAL; } + if (!clib_mem_get_per_cpu_heap () && !clib_mem_init (0, 1024 * 1024 * 32)) + { + return VAPI_ENOMEM; + } ctx->requests_size = max_outstanding_requests; const size_t size = ctx->requests_size * sizeof (*ctx->requests); void *tmp = realloc (ctx->requests, size); -- cgit 1.2.3-korg