Files
snmalloc/src/override/malloc-extensions.h
Matthew Parkinson 77ebff6909 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.
2020-08-28 14:01:52 +01:00

35 lines
803 B
C

/**
* Malloc extensions
*
* This file contains additional non-standard API surface for snmalloc.
* The API is subject to changes, but will be clearly noted in release
* notes.
*/
/**
* Structure for returning memory used by snmalloc.
*
* The statistics are very coarse grained as they only track
* usage at the superslab/chunk level. Meta-data and object
* data is not tracked independantly.
*/
struct malloc_info_v1
{
/**
* Current memory usage of the allocator. Extremely coarse
* grained for efficient calculation.
*/
size_t current_memory_usage;
/**
* High-water mark of current_memory_usage.
*/
size_t peak_memory_usage;
};
/**
* Populates a malloc_info_v1 structure for the latest values
* from snmalloc.
*/
void get_malloc_info_v1(malloc_info_v1* stats);