38 #ifndef _included_clib_mem_h 39 #define _included_clib_mem_h 49 #define CLIB_MAX_MHEAPS 256 77 if (align_offset > align)
80 align_offset %= align;
88 size, align, align_offset,
118 #define clib_mem_alloc_aligned_no_fail(size,align) \ 120 uword _clib_mem_alloc_size = (size); \ 121 void * _clib_mem_alloc_p; \ 122 _clib_mem_alloc_p = clib_mem_alloc_aligned (_clib_mem_alloc_size, (align)); \ 123 if (! _clib_mem_alloc_p) \ 124 clib_panic ("failed to allocate %d bytes", _clib_mem_alloc_size); \ 128 #define clib_mem_alloc_no_fail(size) clib_mem_alloc_aligned_no_fail(size,1) 131 #define clib_mem_alloc_stack(bytes) __builtin_alloca(bytes) 170 if (old_size < new_size)
171 copy_size = old_size;
173 copy_size = new_size;
233 #ifdef CLIB_LINUX_KERNEL 241 #ifdef CLIB_STANDALONE
void clib_mem_validate(void)
always_inline mheap_elt_t * mheap_user_pointer_to_elt(void *v)
void * clib_per_cpu_mheaps[CLIB_MAX_MHEAPS]
always_inline void * clib_mem_alloc_aligned_at_offset(uword size, uword align, uword align_offset)
uword bytes_free_reclaimed
always_inline void clib_mem_free(void *p)
void os_out_of_memory(void)
always_inline uword mheap_data_bytes(void *v, uword uo)
always_inline void * clib_mem_realloc(void *p, uword new_size, uword old_size)
always_inline void * clib_mem_set_per_cpu_heap(u8 *new_heap)
always_inline void * clib_mem_get_per_cpu_heap(void)
always_inline uword clib_mem_size(void *p)
always_inline void * clib_mem_alloc_aligned(uword size, uword align)
uword os_get_cpu_number(void)
u8 * format_clib_mem_usage(u8 *s, va_list *args)
always_inline void * clib_mem_set_heap(void *heap)
always_inline void * clib_mem_get_heap(void)
always_inline uword mheap_elt_data_bytes(mheap_elt_t *e)
void * clib_mem_init(void *heap, uword size)
always_inline void * clib_mem_alloc(uword size)
#define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed)
void * mheap_get_aligned(void *v, uword n_user_data_bytes, uword align, uword align_offset, uword *offset_return)
#define clib_memcpy(a, b, c)
always_inline mheap_elt_t * mheap_next_elt(mheap_elt_t *e)
always_inline mheap_elt_t * mheap_elt_at_uoffset(void *v, uword uo)
always_inline uword clib_mem_is_heap_object(void *p)
void mheap_put(void *v, uword uoffset)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
void clib_mem_usage(clib_mem_usage_t *usage)
#define VALGRIND_FREELIKE_BLOCK(addr, rzB)
void clib_mem_trace(int enable)
uword clib_mem_get_page_size(void)