Loading...
Searching...
No Matches
Public Member Functions | List of all members
v8::Allocator Class Referenceabstract

#include <v8-platform.h>

Public Member Functions

virtual ~Allocator ()=default
 
virtual void * Allocate (size_t size)=0
 
virtual void * AllocateUninitialized (size_t size)=0
 
virtual void * AllocateUninitializedOrCrash (size_t size)=0
 
virtual void Free (void *ptr)=0
 

Detailed Description

An allocator interface for managing memory explicitly.

Implementations of this interface must be thread-safe as V8 will invoke these methods concurrently from multiple threads.

Constructor & Destructor Documentation

◆ ~Allocator()

virtual v8::Allocator::~Allocator ( )
virtualdefault

Member Function Documentation

◆ Allocate()

virtual void * v8::Allocator::Allocate ( size_t  size)
pure virtual

Allocates zero-initialized memory.

Parameters
sizeThe number of bytes to allocate.
Returns
Pointer to the allocated memory or nullptr on failure.

◆ AllocateUninitialized()

virtual void * v8::Allocator::AllocateUninitialized ( size_t  size)
pure virtual

Allocates uninitialized memory.

Parameters
sizeThe number of bytes to allocate.
Returns
Pointer to the allocated memory or nullptr on failure.

◆ AllocateUninitializedOrCrash()

virtual void * v8::Allocator::AllocateUninitializedOrCrash ( size_t  size)
pure virtual

Allocates uninitialized memory.

Parameters
sizeThe number of bytes to allocate.
Returns
Pointer to the allocated memory. Crashes on failure (e.g. OOM). This is intended for critical allocations where failure means the process cannot continue.

◆ Free()

virtual void v8::Allocator::Free ( void *  ptr)
pure virtual

Frees memory that was acquired with one of the allocation methods.

Parameters
ptrPointer to the memory to free. If ptr is nullptr, no operation is performed.

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