[#BloombergLP-ball-CountingAllocator-allocate-09]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/ball.adoc[ball]::xref:BloombergLP/ball/CountingAllocator.adoc[CountingAllocator]::allocate
:relfileprefix: ../../../
:mrdocs:

Allocate a maximally aligned block of the specified `size`&period;

== Synopsis

Declared in `&lt;ball&lowbar;countingallocator&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
virtual
void*
allocate(xref:BloombergLP/bslma/Allocator/size_type.adoc[size&lowbar;type] size) override;
----

== Description

Return a newly allocated block of memory of (at least) the specified positive `size` (bytes) and increment the byte count maintained by this counting allocator by the sum of the least multiple of `bsls&colon;&colon;AlignmentUtil&colon;&colon;BSLS&lowbar;MAX&lowbar;ALIGNMENT` that is greater than or equal to `size` and `bsls&colon;&colon;AlignmentUtil&colon;&colon;BSLS&lowbar;MAX&lowbar;ALIGNMENT`&period; The behavior is undefined unless `0 &lt;&equals; size`&period; Note that the alignment of the address returned is the maximum alignment for any fundamental type defined for the calling platform, even if the supplied allocator guarantees only natural alignment&period;


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