![]() |
GM6000 Digital Heater Controller Branch: main
SDX-1330
|
This class provides methods to access the unit testing support for overriding the global new/delete operators. More...
This class provides methods to access the unit testing support for overriding the global new/delete operators.
The main purpose is to be able to trigger memory allocation failures. It also provides limited memory leak detection.
NOTE: THIS INTERFACE IS NOT THREAD SAFE!!
#include <New_TS.h>
Classes | |
struct | Stats |
New/Delete metrics. More... | |
Static Public Member Functions | |
static void | disable (void) |
This method will cause the next call(s) to 'new' to return a null pointer. | |
static void | enable (void) |
This method 'undos' the disable() call, i.e. | |
static void | setNewDelete_delta (long delta, bool ignoreDelta=false) |
This method is used to set the 'expected' delta between the number of calls to new and delete. | |
static void | getStats (Stats &stats, bool resetStats=true) |
This method returns and optionally clears the metrics collected with respect to Test heap. | |
static void | clearStats () |
This method unconditionally clears the stats. | |
struct Cpl::Memory::New_TS::Stats |
|
static |
This method unconditionally clears the stats.
|
static |
This method will cause the next call(s) to 'new' to return a null pointer.
|
static |
This method 'undos' the disable() call, i.e.
the next call(s) to new will succeed (assuming there is actual heap memory available). This is the default/startup state of the Test heap.
|
static |
This method returns and optionally clears the metrics collected with respect to Test heap.
The caller is responsible for providing the memory for the returned metrics.
|
static |
This method is used to set the 'expected' delta between the number of calls to new and delete.
The default is a delta of zero, i.e. a delete call for every new call.