Reduce the most recently allocated block at address from originalSize to newSize.
Synopsis
Declared in <bdlma_sequentialallocator.h>
bsls::Types::size_type
truncate(
void* address,
bsls::Types::size_type originalSize,
bsls::Types::size_type newSize);
Description
Reduce the amount of memory allocated at the specified address of the specified originalSize (in bytes) to the specified newSize. Return newSize after truncating, or originalSize if the memory block at address cannot be truncated. This method can only truncate the memory block returned by the most recent allocate request from this allocator, and otherwise has no effect. The behavior is undefined unless the memory block at address was originally allocated by this allocator, the size of the memory block at address is originalSize, newSize <= originalSize, and release was not called after allocating the memory block at address.
Return Value
newSize after truncating, or originalSize if the memory block at address cannot be truncated
Parameters
Name |
Description |
address |
address of the most recently allocated block |
originalSize |
original size, in bytes, of the block at |
newSize |
desired size, in bytes, after truncation |
Created with MrDocs