[#BloombergLP-bdlma-GuardingAllocator-allocate-0b]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlma.adoc[bdlma]::xref:BloombergLP/bdlma/GuardingAllocator.adoc[GuardingAllocator]::allocate
:relfileprefix: ../../../
:mrdocs:

Return a newly allocated maximally&hyphen;aligned block of `size` bytes with an adjoining protected guard page&period;

== Synopsis

Declared in `&lt;bdlma&lowbar;guardingallocator&period;h&gt;`

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

== Description

Return a newly&hyphen;allocated maximally&hyphen;aligned block of memory of the specified `size` (in bytes) that has a read&sol;write protected guard page located immediately before or after it according to the `GuardPageLocation` indicated at construction&period; If `size` is 0, no memory is allocated and 0 is returned&period; Note that a multiple of the platform&apos;s memory page size is allocated for _every_ call to this method&period;

== Return Value

address of the newly allocated block, or a null pointer if `size` is 0

== Parameters

[cols="1,4"]
|===
| Name| Description
| *size*
| number of bytes to allocate
|===


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