Deallocate a block of raw memory previously allocated by allocateBytes.

Synopsis

Declared in <bslma_allocatorutil.h>

template<class t_ALLOCATOR>
static
void
deallocateBytes(
    t_ALLOCATOR const& allocator,
    AllocatorUtil_Traits<t_ALLOCATOR>::void_pointer p,
    std::size_t nbytes,
    std::size_t alignment = 0);

Description

Give back, to the specified allocator, the block of raw memory at the specified p address 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. The behavior is undefined unless p refers to a block having the same size and alignment previously allocated from a copy of allocator and not yet deallocated.

Parameters

Name

Description

allocator

allocator to which to return the memory

p

address of the block to deallocate

nbytes

size in bytes of the block at p

alignment

alignment used when the block was allocated; 0 means natural alignment

Created with MrDocs