[#BloombergLP-bslma-AllocatorUtil-allocateBytes] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::xref:BloombergLP/bslma/AllocatorUtil.adoc[AllocatorUtil]::allocateBytes :relfileprefix: ../../../ :mrdocs: Allocate raw memory of the given size and alignment. == Synopsis Declared in `<bslma_allocatorutil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class t_ALLOCATOR> static AllocatorUtil_Traits<t_ALLOCATOR>::void_pointer allocateBytes( t_ALLOCATOR const& allocator, std::size_t nbytes, std::size_t alignment = 0); ---- == Description Return a pointer to a block of raw memory allocated from the specified `allocator` having the specified `nbytes` size and optionally specified `alignment`. If `alignment` is not specified, the natural alignment for an object of size `nbytes` is used. If `alignment` is larger than the largest supported alignment for `t_ALLOCATOR`, either the block will be aligned to the maximum supported alignment or an exception will be thrown; the specific choice of behavior is determined by the allocator. For polymorphic allocators the behavior of extended alignment is determined by the memory resource, whereas for non‐polymorphic allocators, the alignment is always truncated to the maximum non‐extended alignment. == Return Value pointer to a block of raw memory of size `nbytes` == Parameters [cols="1,4"] |=== | Name| Description | *allocator* | allocator from which to allocate | *nbytes* | number of bytes to allocate | *alignment* | requested alignment; 0 means natural alignment |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#