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:
committed by
GitHub
parent
234c0e2e8e
commit
77ebff6909
12
src/override/malloc-extensions.cc
Normal file
12
src/override/malloc-extensions.cc
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user