[#BloombergLP-bslma-Allocator-do_allocate]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::xref:BloombergLP/bslma/Allocator.adoc[Allocator]::do&lowbar;allocate
:relfileprefix: ../../../
:mrdocs:

Return a newly allocated block of memory of (at least) the specified positive `bytes` and having at least the specified `alignment`&period; Unless overriden in a derived class, the return value is `this&hyphen;&gt;allocate(bytes)`&period; If this allocator cannot return the requested number of bytes or cannot satisfy the alignment request, then it will throw a `std&colon;&colon;bad&lowbar;alloc` exception in an exception&hyphen;enabled build, or else will abort the program in a non&hyphen;exception build&period; Unless overriden in a derived class, this function will forward the allocation request to the `allocate` virtual function, padding `bytes` and adjusting the return value as necessary to ensure sufficient alignment&period; Note that if `bytes` is `0`, the same non&hyphen;null value will be returned every time&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
virtual
void*
do&lowbar;allocate(
    std::size&lowbar;t bytes,
    std::size&lowbar;t alignment) override;
----


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