v8  5.8.282(node8.0.0)
V8 is Google's open source JavaScript engine
ArrayBuffer::Allocator Class Referenceabstract

#include <v8.h>

Public Member Functions

virtual ~Allocator ()
 
virtual void * Allocate (size_t length)=0
 
virtual void * AllocateUninitialized (size_t length)=0
 
virtual void Free (void *data, size_t length)=0
 

Static Public Member Functions

static AllocatorNewDefaultAllocator ()
 

Detailed Description

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 3987 of file v8.h.

Constructor & Destructor Documentation

virtual ~Allocator ( )
inlinevirtual

Definition at line 3989 of file v8.h.

Member Function Documentation

virtual void* Allocate ( size_t  length)
pure virtual

Allocate |length| bytes. Return NULL if allocation is not successful. Memory should be initialized to zeroes.

virtual void* AllocateUninitialized ( size_t  length)
pure virtual

Allocate |length| bytes. Return NULL if allocation is not successful. Memory does not have to be initialized.

virtual void 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|.

static Allocator* NewDefaultAllocator ( )
static

malloc/free based convenience allocator.

Caller takes ownership.


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