[#BloombergLP-bdlma-BufferManager-replaceBuffer] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlma.adoc[bdlma]::xref:BloombergLP/bdlma/BufferManager.adoc[BufferManager]::replaceBuffer :relfileprefix: ../../../ :mrdocs: Replace the managed buffer with `newBuffer` of `newBufferSize`. == Synopsis Declared in `<bdlma_buffermanager.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- char* replaceBuffer( char* newBuffer, xref:BloombergLP/bsls/Types/size_type.adoc[bsls::Types::size_type] newBufferSize); ---- == Description Replace the buffer currently managed by this object with the specified `newBuffer` of the specified `newBufferSize` (in bytes); return the address of the previously held buffer, or 0 if this object currently manages no buffer. The replaced buffer (if any) is removed from the management of this object with no effect on the outstanding allocated memory blocks. Subsequent allocations will allocate memory from the beginning of the new external buffer. The behavior is undefined unless `0 < newBufferSize` and `newBuffer` has at least `newBufferSize` bytes. == Return Value address of the previously held buffer, or 0 if this object currently manages no buffer == Parameters [cols="1,4"] |=== | Name| Description | *newBuffer* | external buffer to manage | *newBufferSize* | size in bytes of `newBuffer` |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#