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

This class implements a guard that unconditionally deallocates a block of managed memory upon destruction by invoking the `deallocate` method of an allocator (or pool) of parameterized `ALLOCATOR` type supplied to it at construction&period; The managed memory must have been supplied by the allocator (or pool), which must remain valid throughout the lifetime of the guard object&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class ALLOCATOR&gt;
class DeallocatorGuard;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslma/DeallocatorGuard/2constructor.adoc[`DeallocatorGuard`]         [.small]#[constructor]#
| Create a deallocator guard that unconditionally manages the specified `memory` block, and that uses the specified `allocator` to deallocate `memory` upon destruction of this guard&period; The behavior is undefined unless `memory` and `allocator` are non&hyphen;zero, and `allocator` supplied `memory`&period; Note that `allocator` must remain valid throughout the lifetime of this guard&period;
| xref:BloombergLP/bslma/DeallocatorGuard/2destructor.adoc[`&#126;DeallocatorGuard`] [.small]#[destructor]#
| Destroy this deallocator guard and deallocate the block of memory it manages by invoking the `deallocate` method of the allocator (or pool) that was supplied with the address of the (managed) memory at construction&period;
|===



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