#endif /* DEFAULT_TRIM_THRESHOLD */
#ifndef DEFAULT_MMAP_THRESHOLD
#if HAVE_MMAP
-#define DEFAULT_MMAP_THRESHOLD ((size_t)256U * (size_t)1024U)
+/*
+ * The default value in the dlmalloc was set as follows:
+ *
+ * #define DEFAULT_MMAP_THRESHOLD ((size_t)256U * (size_t)1024U)
+ *
+ * Above this threshold the sys_alloc() calls mmap_alloc() to directly mmap the memory.
+ * However, the interaction of this path with the rest of the vpp infra results
+ * in vpp infra considering directly mmap-allocated pieces to not
+ * be part of the heap, with predictable consequence.
+ *
+ * A simple unit-test to show that behavior is to make a small private
+ * heap and repeatedly perform vec_add1() within that heap.
+ *
+ * The issue is because there is no tracking which mmap-allocated chunk
+ * belongs to which heap.
+ *
+ * The temporary approach is to dial up the threshold so that the problematic
+ * code path never gets called. The full fix needs to introduce
+ * introduce the vector of mmap-allocated chunks to mspace, and in general
+ * do some more thorough testing.
+ */
+#define DEFAULT_MMAP_THRESHOLD ((size_t)~0ULL)
#else /* HAVE_MMAP */
#define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T
#endif /* HAVE_MMAP */
*/
DLMALLOC_EXPORT int mspace_mallopt(int, int);
-DLMALLOC_EXPORT void* mspace_get_aligned (mspace msp,
- unsigned long long n_user_data_bytes,
- unsigned long long align,
- unsigned long long align_offset);
+DLMALLOC_EXPORT void* mspace_get_aligned (mspace msp,
+ unsigned long n_user_data_bytes,
+ unsigned long align,
+ unsigned long align_offset);
DLMALLOC_EXPORT int mspace_is_heap_object (mspace msp, void *p);
-DLMALLOC_EXPORT void mspace_get_address_and_size (mspace msp,
- unsigned long long *addrp,
- unsigned long long *sizep);
+DLMALLOC_EXPORT void mspace_get_address_and_size (mspace msp, char **addrp, size_t *sizep);
DLMALLOC_EXPORT void mspace_put (mspace msp, void *p);
DLMALLOC_EXPORT void mspace_put_no_offset (mspace msp, void *p);
DLMALLOC_EXPORT size_t mspace_usable_size_with_delta (const void *p);
DLMALLOC_EXPORT void mspace_disable_expand (mspace msp);
DLMALLOC_EXPORT void *mspace_least_addr (mspace msp);
-DLMALLOC_EXPORT void mheap_get_trace (u64 offset, u64 size);
-DLMALLOC_EXPORT void mheap_put_trace (u64 offset, u64 size);
+DLMALLOC_EXPORT void mheap_get_trace (uword offset, uword size);
+DLMALLOC_EXPORT void mheap_put_trace (uword offset, uword size);
DLMALLOC_EXPORT int mspace_enable_disable_trace (mspace msp, int enable);
+DLMALLOC_EXPORT int mspace_is_traced (mspace msp);
#endif /* MSPACES */