aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/mem_dlmalloc.c
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2019-06-16 12:33:51 +0200
committerNeale Ranns <nranns@cisco.com>2019-06-18 13:01:15 +0000
commit92e3082199d10add866894e86a9762d79a3536c4 (patch)
tree224d269fba3ec3b0c5ca456a7ede032d4163335d /src/vppinfra/mem_dlmalloc.c
parentae8819f0a426953aa7ebf97c2e26940525b55fb1 (diff)
stats: fix memory leakage when adding / deleting interfaces
This fixes two leaks in registering errors in the stats segment. - The error name created by vlib_register_errors() was not freed. - Duplicate error names (when interface readded) was added to the vector. This fix also adds memory usage statistics for the statistics segment as /mem/statseg/{used, total} Change-Id: Ife98d5fc5baef5bdae426a5a1eef428af2b9ab8a Type: fix Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vppinfra/mem_dlmalloc.c')
-rw-r--r--src/vppinfra/mem_dlmalloc.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/vppinfra/mem_dlmalloc.c b/src/vppinfra/mem_dlmalloc.c
index 99f1c04f3eb..7a53a8bb43b 100644
--- a/src/vppinfra/mem_dlmalloc.c
+++ b/src/vppinfra/mem_dlmalloc.c
@@ -383,6 +383,21 @@ clib_mem_usage (clib_mem_usage_t * u)
clib_warning ("unimp");
}
+void
+mheap_usage (void *heap, clib_mem_usage_t * usage)
+{
+ struct dlmallinfo mi = mspace_mallinfo (heap);
+
+ /* TODO: Fill in some more values */
+ usage->object_count = 0;
+ usage->bytes_total = mi.arena;
+ usage->bytes_overhead = 0;
+ usage->bytes_max = 0;
+ usage->bytes_used = mi.uordblks;
+ usage->bytes_free = mi.fordblks;
+ usage->bytes_free_reclaimed = 0;
+}
+
/* Call serial number for debugger breakpoints. */
uword clib_mem_validate_serial = 0;