vppinfra: fix memory trace 89/36189/2
authorLeung Lai Yung <benkerbuild@gmail.com>
Sun, 22 May 2022 13:25:53 +0000 (13:25 +0000)
committerDamjan Marion <dmarion@me.com>
Tue, 24 May 2022 14:04:06 +0000 (14:04 +0000)
Type: fix

reset the memory trace if mem trace is turned on

Signed-off-by: Leung Lai Yung <benkerbuild@gmail.com>
Change-Id: Ib99355b9ed42ff66c720bbea5cbbf03c65820d12

src/vppinfra/mem_dlmalloc.c

index ffffec8..25014c8 100644 (file)
@@ -698,6 +698,11 @@ clib_mem_heap_realloc_aligned (void *heap, void *p, uword new_size,
       mspace_realloc_in_place (h->mspace, p, new_size))
     {
       clib_mem_unpoison (p, new_size);
+      if (PREDICT_FALSE (h->flags & CLIB_MEM_HEAP_F_TRACED))
+       {
+         mheap_put_trace (pointer_to_uword (p), old_alloc_size);
+         mheap_get_trace (pointer_to_uword (p), clib_mem_size (p));
+       }
     }
   else
     {