1.26.2.1
Gameface
cohtml::IVirtualAllocator Class Referenceabstract

Virtual memory allocator interface used by Cohtml for scripting memory allocations. More...

Public Member Functions

 IVirtualAllocator ()
 
virtual ~IVirtualAllocator ()
 
virtual size_t GetAllocationPageSize () const =0
 
virtual size_t GetCommitPageSize () const =0
 
virtual void * Allocate (void *address, size_t size, size_t alignment, int protection, int flags)=0
 Reserve and/or commit a memory region. More...
 
virtual bool Free (void *address, size_t size, int flags)=0
 Releases or decommits a memory region. More...
 

Detailed Description

Virtual memory allocator interface used by Cohtml for scripting memory allocations.

Constructor & Destructor Documentation

◆ IVirtualAllocator()

cohtml::IVirtualAllocator::IVirtualAllocator ( )

◆ ~IVirtualAllocator()

virtual cohtml::IVirtualAllocator::~IVirtualAllocator ( )
virtual

Member Function Documentation

◆ Allocate()

virtual void* cohtml::IVirtualAllocator::Allocate ( void *  address,
size_t  size,
size_t  alignment,
int  protection,
int  flags 
)
pure virtual

Reserve and/or commit a memory region.

Parameters
addressa hint when reserving memory and a concrete address when commiting.
sizethe number of bytes to allocate.
alignmentthe required alignment for the return address.
protectionspecifies a protection type for the memory region.
flagstype of the allocation (commit, reserve or reserve & commit).
Returns
address of the allocated memory region.

◆ Free()

virtual bool cohtml::IVirtualAllocator::Free ( void *  address,
size_t  size,
int  flags 
)
pure virtual

Releases or decommits a memory region.

Parameters
addressa concrete address to release or decommit.
sizethe number of bytes to deallocate.
flagstype of the deallocation (decommit or release).
Returns
true if the function succeeds, otherwise false.
Note
A release call is expected to also decommit the memory.

◆ GetAllocationPageSize()

virtual size_t cohtml::IVirtualAllocator::GetAllocationPageSize ( ) const
pure virtual
Returns
the page granularity for reserving memory.

◆ GetCommitPageSize()

virtual size_t cohtml::IVirtualAllocator::GetCommitPageSize ( ) const
pure virtual
Returns
the page granularity for commiting memory.