+ h = base;
+ h->base = base;
+ h->size = size;
+ h->log2_page_sz = log2_page_sz;
+ h->flags = flags;
+ sz = strlen (name);
+ strcpy (h->name, name);
+ sz = round_pow2 (sz + sizeof (clib_mem_heap_t), 16);
+ h->mspace = create_mspace_with_base (base + sz, size - sz, is_locked);
+
+ mspace_disable_expand (h->mspace);
+
+ CLIB_MEM_POISON (mspace_least_addr (h->mspace),
+ mspace_footprint (h->mspace));
+
+ return h;
+}
+
+/* Initialize CLIB heap based on memory/size given by user.
+ Set memory to 0 and CLIB will try to allocate its own heap. */
+static void *
+clib_mem_init_internal (void *base, uword size,
+ clib_mem_page_sz_t log2_page_sz)
+{
+ clib_mem_heap_t *h;
+
+ clib_mem_main_init ();
+
+ h = clib_mem_create_heap_internal (base, size, log2_page_sz,
+ 1 /*is_locked */ , "main heap");
+
+ clib_mem_set_heap (h);