ezEngine Release 26.3
Loading...
Searching...
No Matches
ezInternal::ezAllocatorImpl< AllocationPolicy, TrackingMode > Class Template Reference
Inheritance diagram for ezInternal::ezAllocatorImpl< AllocationPolicy, TrackingMode >:

Public Member Functions

 ezAllocatorImpl (ezStringView sName, ezAllocator *pParent)
 
virtual void * Allocate (size_t uiSize, size_t uiAlign, ezMemoryUtils::DestructorFunction destructorFunc=nullptr) override
 Interface, do not use this directly, always use the new/delete macros below.
 
virtual void Deallocate (void *pPtr) override
 Deallocates memory previously allocated by this allocator.
 
virtual size_t AllocatedSize (const void *pPtr) override
 Returns the number of bytes allocated at this address.
 
virtual ezAllocatorId GetId () const override
 
virtual Stats GetStats () const override
 
ezAllocatorGetParent () const
 
- Public Member Functions inherited from ezAllocator
virtual void * Reallocate (void *pPtr, size_t uiCurrentSize, size_t uiNewSize, size_t uiAlign)
 Reallocates memory, potentially moving the data to a new location.
 

Protected Attributes

AllocationPolicy m_allocator
 
ezAllocatorId m_Id
 
ezThreadID m_ThreadID
 

Member Function Documentation

◆ Allocate()

template<typename A , ezAllocatorTrackingMode TrackingMode>
void * ezInternal::ezAllocatorImpl< A, TrackingMode >::Allocate ( size_t  uiSize,
size_t  uiAlign,
ezMemoryUtils::DestructorFunction  destructorFunc = nullptr 
)
overridevirtual

Interface, do not use this directly, always use the new/delete macros below.

Allocates aligned memory of the specified size. The destructorFunc parameter is used for automatic cleanup when the allocator is reset or destroyed (mainly used by linear allocators).

Implements ezAllocator.

Reimplemented in ezLinearAllocator< TrackingMode, OverwriteMemoryOnReset >, ezLinearAllocator< ezAllocatorTrackingMode::Basics >, and ezLinearAllocator< ezAllocatorTrackingMode::Nothing >.

◆ AllocatedSize()

template<typename A , ezAllocatorTrackingMode TrackingMode>
size_t ezInternal::ezAllocatorImpl< A, TrackingMode >::AllocatedSize ( const void *  pPtr)
overridevirtual

Returns the number of bytes allocated at this address.

This information is only available if allocation tracking is enabled (see ezAllocatorTrackingMode and EZ_ALLOC_TRACKING_DEFAULT). Returns 0 when tracking is disabled or for invalid pointers. Primarily used for debugging and memory analysis.

Implements ezAllocator.

◆ Deallocate()

template<typename A , ezAllocatorTrackingMode TrackingMode>
void ezInternal::ezAllocatorImpl< A, TrackingMode >::Deallocate ( void *  pPtr)
overridevirtual

Deallocates memory previously allocated by this allocator.

The pointer must have been returned by a previous call to Allocate() on this allocator instance. Passing nullptr is safe and will be ignored.

Implements ezAllocator.

Reimplemented in ezLinearAllocator< TrackingMode, OverwriteMemoryOnReset >, ezLinearAllocator< ezAllocatorTrackingMode::Basics >, and ezLinearAllocator< ezAllocatorTrackingMode::Nothing >.

◆ GetId()

template<typename A , ezAllocatorTrackingMode TrackingMode>
ezAllocatorId ezInternal::ezAllocatorImpl< A, TrackingMode >::GetId ( ) const
overridevirtual

Implements ezAllocator.

◆ GetStats()

template<typename A , ezAllocatorTrackingMode TrackingMode>
ezAllocator::Stats ezInternal::ezAllocatorImpl< A, TrackingMode >::GetStats ( ) const
overridevirtual

Implements ezAllocator.


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