A thread-safe allocator that V8 uses to allocate |ArrayBuffer|'s memory. The allocator is a global V8 setting. It has to be set via Isolate::CreateParams.
Memory allocated through this allocator by V8 is accounted for as external memory by V8. Note that V8 keeps track of the memory for all internalized |ArrayBuffer|s. Responsibility for tracking external memory (using Isolate::AdjustAmountOfExternalAllocatedMemory) is handed over to the embedder upon externalization and taken over upon internalization (creating an internalized buffer from an existing buffer).
Note that it is unsafe to call back into V8 from any of the allocator functions.
Definition at line 5038 of file v8.h.
| virtual void* v8::ArrayBuffer::Allocator::Reallocate |
( |
void * |
data, |
|
|
size_t |
old_length, |
|
|
size_t |
new_length |
|
) |
| |
|
virtual |
Reallocate the memory block of size |old_length| to a memory block of size |new_length| by expanding, contracting, or copying the existing memory block. If |new_length| > |old_length|, then the new part of the memory must be initialized to zeros. Return nullptr if reallocation is not successful.
The caller guarantees that the memory block was previously allocated using Allocate or AllocateUninitialized.
The default implementation allocates a new block and copies data.