summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/mheap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vppinfra/mheap.c')
-rw-r--r--src/vppinfra/mheap.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/vppinfra/mheap.c b/src/vppinfra/mheap.c
index 0c72c888498..5b71873b9ed 100644
--- a/src/vppinfra/mheap.c
+++ b/src/vppinfra/mheap.c
@@ -975,6 +975,29 @@ mheap_alloc (void *memory, uword size)
}
void *
+mheap_alloc_with_lock (void *memory, uword size, int locked)
+{
+ uword flags = 0;
+ void *rv;
+
+ if (memory != 0)
+ flags |= MHEAP_FLAG_DISABLE_VM;
+
+#ifdef CLIB_HAVE_VEC128
+ flags |= MHEAP_FLAG_SMALL_OBJECT_CACHE;
+#endif
+
+ rv = mheap_alloc_with_flags (memory, size, flags);
+
+ if (rv && locked)
+ {
+ mheap_t *h = mheap_header (rv);
+ h->flags |= MHEAP_FLAG_THREAD_SAFE;
+ }
+ return rv;
+}
+
+void *
_mheap_free (void *v)
{
mheap_t *h = mheap_header (v);