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

Destroy `object` by dynamic type and deallocate its memory&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class TYPE,
    class ALLOCATOR&gt;
static
void
deleteObject(
    TYPE const* object,
    ALLOCATOR* allocator);
----

== Description

Destroy the specified `object` based on its dynamic type and then use the specified `allocator` to deallocate its memory footprint&period; Do nothing if `object` is a null pointer&period; The behavior is undefined unless `allocator` is non&hyphen;null, and `object`, when cast appropriately to `void &ast;`, was allocated using `allocator` and has not already been deallocated&period; Note that `dynamic&lowbar;cast&lt;void &ast;&gt;(object)` is applied if `TYPE` is polymorphic, and `static&lowbar;cast&lt;void &ast;&gt;(object)` is applied otherwise&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *object*
| object to destroy and whose memory to deallocate
| *allocator*
| allocator (or pool) that supplied `object`&apos;s memory
|===


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