diff options
author | Dave Barach <dave@barachs.net> | 2020-08-28 10:39:00 -0400 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2020-08-28 15:31:07 +0000 |
commit | 2b79341dcafe8fa9397acf42b8021c88664db2df (patch) | |
tree | 6bfc5c5c86d5e6c42f62445d68822adab48eac00 /src/vppinfra/mem_dlmalloc.c | |
parent | e6df80de415f53a7df326d06ab4a8a60a96ba039 (diff) |
vppinfra: add clib_mem_destroy_mspace(void *ms)
Also clib_mem_destroy() to destroy the current mspace.
Handy when an application wants to make a memory allocation arena
disappear.
Type: improvement
Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I020db902fbe2473545506fecbc230c2b048992f8
Diffstat (limited to 'src/vppinfra/mem_dlmalloc.c')
-rw-r--r-- | src/vppinfra/mem_dlmalloc.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/vppinfra/mem_dlmalloc.c b/src/vppinfra/mem_dlmalloc.c index 663b2f162f7..1b0dbb24500 100644 --- a/src/vppinfra/mem_dlmalloc.c +++ b/src/vppinfra/mem_dlmalloc.c @@ -237,6 +237,23 @@ clib_mem_init_thread_safe (void *memory, uword memory_size) 1 /* do clib_mem_set_heap */ ); } +void +clib_mem_destroy_mspace (void *mspace) +{ + mheap_trace_main_t *tm = &mheap_trace_main; + + if (tm->enabled && mspace == tm->current_traced_mheap) + tm->enabled = 0; + + destroy_mspace (mspace); +} + +void +clib_mem_destroy (void) +{ + clib_mem_destroy_mspace (clib_mem_get_heap ()); +} + void * clib_mem_init_thread_safe_numa (void *memory, uword memory_size, u8 numa) { |