diff options
| author | Quentin Young <qlyoung@users.noreply.github.com> | 2018-08-14 11:43:39 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-14 11:43:39 -0400 |
| commit | 94cb1f61a4096f601bb35f58108228121302f95d (patch) | |
| tree | 92250ab0f57b3f02bddbfa560a762d178b2254d0 /lib/memory.h | |
| parent | 6c705218232ce1513b2a43fa4e2307cc378a52f1 (diff) | |
| parent | 7aea4b816790cae57547f3e3d8e0185de69973ce (diff) | |
Merge pull request #2805 from opensourcerouting/malloc-size
lib: track total memory per MTYPE if possible
Diffstat (limited to 'lib/memory.h')
| -rw-r--r-- | lib/memory.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/memory.h b/lib/memory.h index 1fbbbe4231..c39f34e3a7 100644 --- a/lib/memory.h +++ b/lib/memory.h @@ -24,12 +24,20 @@ #define array_size(ar) (sizeof(ar) / sizeof(ar[0])) +#if defined(HAVE_MALLOC_SIZE) && !defined(HAVE_MALLOC_USABLE_SIZE) +#define malloc_usable_size(x) malloc_size(x) +#define HAVE_MALLOC_USABLE_SIZE +#endif + #define SIZE_VAR ~0UL struct memtype { struct memtype *next, **ref; const char *name; _Atomic size_t n_alloc; _Atomic size_t size; +#ifdef HAVE_MALLOC_USABLE_SIZE + _Atomic size_t total; +#endif }; struct memgroup { |
