folly::checkedRealloc

Trivial wrapper around realloc that check for allocation failure and throw std::bad_alloc in that case.

Synopsis

Declared in <folly/memory/Malloc.h>

void*
checkedRealloc(
    void* ptr,
    size_t size);

Description

methodset Allocation Wrappers

Return Value

pointer to reallocated buffer

Parameters

NameDescription
ptrpointer to start of buffer
sizesize to reallocate starting from ptr