Added simple stats tracking memory usage (#241)

These statistics can be maintained with effectively zero cost to
realistic applications.  They do not track the precise amount of
memory used, but are an over-approximation.
This commit is contained in:
Matthew Parkinson
2020-08-28 14:01:52 +01:00
committed by GitHub
parent 234c0e2e8e
commit 77ebff6909
4 changed files with 180 additions and 5 deletions

View File

@@ -0,0 +1,12 @@
#include "malloc-extensions.h"
#include "../snmalloc.h"
using namespace snmalloc;
void get_malloc_info_v1(malloc_info_v1* stats)
{
auto next_memory_usage = default_memory_provider().memory_usage();
stats->current_memory_usage = next_memory_usage.first;
stats->peak_memory_usage = next_memory_usage.second;
}