[#BloombergLP-bdld-Datum-destroy]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdld.adoc[bdld]::xref:BloombergLP/bdld/Datum.adoc[Datum]::destroy
:relfileprefix: ../../../
:mrdocs:

Destroy `value` and deallocate any memory it owns via `allocator`&period;

== Synopsis

Declared in `&lt;bdld&lowbar;datum&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
void
destroy(
    xref:BloombergLP/bdld/Datum.adoc[Datum] const& value,
    xref:BloombergLP/bdld/Datum/AllocatorType.adoc[AllocatorType] const& allocator);
----

== Description

Deallocate any memory that was previously allocated within the specified `value` using the specified `allocator`&period; If the `value` contains an adopted array of datums, `destroy` is called on each array element&period; If the `value` contains an adopted map of datums, `destroy` is called on each map element&period; The behavior is undefined unless all dynamically allocated memory owned by `value` was allocated using `allocator`, and has not previously been released by a call to `destroy`, either on this object, or on another object referring to same contents as this object (i&period;e&period;, only one copy of a `Datum` object can be destroyed)&period; The behavior is also undefined if `value` has an uninitialized or partially initialized array or map (created using `createUninitializedArray`, `createUninitializedMap` or `createUninitializeMapOwningKeys`)&period; Note that after this operation completes, `value` is left in an uninitialized state, and must be assigned a new value before being accessed again&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *value*
| datum whose owned memory is released
| *allocator*
| memory allocator to use
|===


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