diff options
author | Dave Barach <dave@barachs.net> | 2020-02-11 15:06:34 -0500 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2020-02-11 23:57:18 +0000 |
commit | 2c8e0023f91882e53f06eb99c901b97fe013f981 (patch) | |
tree | a0026aa039284780b7ec5da6f913e9cab5edd489 /src/vppinfra/mem.h | |
parent | a6ef36b2c25de47824a1b45e147ab2fbf67c3a33 (diff) |
vppinfra: remove the historical mheap memory allocator
The mheap allocator has been turned off for several releases. This
commit removes the cmake config parameter, parallel support for
dlmalloc and mheap, and the mheap allocator itself.
Type: refactor
Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I104f88a1f06e47e90e5f7fb3e11cd1ca66467903
Diffstat (limited to 'src/vppinfra/mem.h')
-rw-r--r-- | src/vppinfra/mem.h | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/src/vppinfra/mem.h b/src/vppinfra/mem.h index 0f8bd482a90..4fedd107754 100644 --- a/src/vppinfra/mem.h +++ b/src/vppinfra/mem.h @@ -45,11 +45,7 @@ #include <vppinfra/clib.h> /* uword, etc */ #include <vppinfra/clib_error.h> -#if USE_DLMALLOC == 0 -#include <vppinfra/mheap_bootstrap.h> -#else #include <vppinfra/dlmalloc.h> -#endif #include <vppinfra/os.h> #include <vppinfra/string.h> /* memcpy, clib_memset */ @@ -121,12 +117,7 @@ clib_mem_set_thread_index (void) always_inline uword clib_mem_size_nocheck (void *p) { -#if USE_DLMALLOC == 0 - mheap_elt_t *e = mheap_user_pointer_to_elt (p); - return mheap_elt_data_bytes (e); -#else return mspace_usable_size_with_delta (p); -#endif } /* Memory allocator which may call os_out_of_memory() if it fails */ @@ -148,15 +139,7 @@ clib_mem_alloc_aligned_at_offset (uword size, uword align, uword align_offset, cpu = os_get_thread_index (); heap = clib_per_cpu_mheaps[cpu]; -#if USE_DLMALLOC == 0 - uword offset; - heap = mheap_get_aligned (heap, size, align, align_offset, &offset); - clib_per_cpu_mheaps[cpu] = heap; - if (PREDICT_TRUE (offset != ~0)) - p = heap + offset; -#else p = mspace_get_aligned (heap, size, align, align_offset); -#endif /* USE_DLMALLOC */ if (PREDICT_FALSE (0 == p)) { @@ -223,24 +206,9 @@ clib_mem_alloc_aligned_or_null (uword size, uword align) always_inline uword clib_mem_is_heap_object (void *p) { -#if USE_DLMALLOC == 0 - void *heap = clib_mem_get_per_cpu_heap (); - uword offset = (uword) p - (uword) heap; - mheap_elt_t *e, *n; - - if (offset >= vec_len (heap)) - return 0; - - e = mheap_elt_at_uoffset (heap, offset); - n = mheap_next_elt (e); - - /* Check that heap forward and reverse pointers agree. */ - return e->n_user_data == n->prev_n_user_data; -#else void *heap = clib_mem_get_per_cpu_heap (); return mspace_is_heap_object (heap, p); -#endif /* USE_DLMALLOC */ } always_inline void @@ -253,11 +221,7 @@ clib_mem_free (void *p) CLIB_MEM_POISON (p, clib_mem_size_nocheck (p)); -#if USE_DLMALLOC == 0 - mheap_put (heap, (u8 *) p - heap); -#else mspace_put (heap, p); -#endif } always_inline void * |