V8 Project
v8::ArrayBuffer::Allocator Class Referenceabstract

Allocator that V8 uses to allocate |ArrayBuffer|'s memory. More...

#include <v8.h>

+ Inheritance diagram for v8::ArrayBuffer::Allocator:
+ Collaboration diagram for v8::ArrayBuffer::Allocator:

Public Member Functions

virtual ~Allocator ()
 
virtual void * Allocate (size_t length)=0
 Allocate |length| bytes. More...
 
virtual void * AllocateUninitialized (size_t length)=0
 Allocate |length| bytes. More...
 
virtual void Free (void *data, size_t length)=0
 Free the memory block of size |length|, pointed to by |data|. More...
 

Detailed Description

Allocator that V8 uses to allocate |ArrayBuffer|'s memory.

The allocator is a global V8 setting. It should be set with V8::SetArrayBufferAllocator prior to creation of a first ArrayBuffer.

This API is experimental and may change significantly.

Definition at line 2859 of file v8.h.

Constructor & Destructor Documentation

◆ ~Allocator()

virtual v8::ArrayBuffer::Allocator::~Allocator ( )
inlinevirtual

Definition at line 2861 of file v8.h.

2861 {}

Member Function Documentation

◆ Allocate()

virtual void* v8::ArrayBuffer::Allocator::Allocate ( size_t  length)
pure virtual

Allocate |length| bytes.

Return NULL if allocation is not successful. Memory should be initialized to zeroes.

Implemented in v8::MockArrayBufferAllocator, and v8::ShellArrayBufferAllocator.

Referenced by v8::internal::Runtime::SetupArrayBufferAllocatingData().

+ Here is the caller graph for this function:

◆ AllocateUninitialized()

virtual void* v8::ArrayBuffer::Allocator::AllocateUninitialized ( size_t  length)
pure virtual

Allocate |length| bytes.

Return NULL if allocation is not successful. Memory does not have to be initialized.

Implemented in v8::MockArrayBufferAllocator, and v8::ShellArrayBufferAllocator.

Referenced by v8::internal::Runtime::SetupArrayBufferAllocatingData().

+ Here is the caller graph for this function:

◆ Free()

virtual void v8::ArrayBuffer::Allocator::Free ( void *  data,
size_t  length 
)
pure virtual

Free the memory block of size |length|, pointed to by |data|.

That memory is guaranteed to be previously allocated by |Allocate|.

Implemented in v8::MockArrayBufferAllocator, and v8::ShellArrayBufferAllocator.

Referenced by v8::internal::Runtime::FreeArrayBuffer(), v8::internal::FreeBufferExtension::FreeBuffer(), and v8::internal::RUNTIME_FUNCTION().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: