[#BloombergLP-bslma-TestAllocatorStatisticsGuard]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::TestAllocatorStatisticsGuard
:relfileprefix: ../../
:mrdocs:

This mechanism provides the means to get localized `TestAllocator` statistics in a scope since the construction of the guard, and also reinstates the statistics upon its destruction as if the local reset has not happened&period; See the  section for the statistics managed&period;

== Synopsis

Declared in `&lt;bslma&lowbar;testallocatorstatisticsguard&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class TestAllocatorStatisticsGuard;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslma/TestAllocatorStatisticsGuard/2constructor.adoc[`TestAllocatorStatisticsGuard`]         [.small]#[constructor]#
| Create a `TestAllocatorStatisticsGuard` object to stash, reset, and restore statistics of the specified `testAllocator`&period;
| xref:BloombergLP/bslma/TestAllocatorStatisticsGuard/2destructor.adoc[`&#126;TestAllocatorStatisticsGuard`] [.small]#[destructor]#
| Destroy this object and restore the statistics of the `testAllocator` supplied at construction to a state as if this guard had never existed&period;
| xref:BloombergLP/bslma/TestAllocatorStatisticsGuard/originalNumBlocksInUse.adoc[`originalNumBlocksInUse`] 
| Return the stashed value of `numBlocksInUse` at construction&period;
| xref:BloombergLP/bslma/TestAllocatorStatisticsGuard/originalNumBytesInUse.adoc[`originalNumBytesInUse`] 
| Return the stashed value of `numBytesInUse` at construction&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
