Pigweed
Loading...
Searching...
No Matches
pw::allocator::Pool Class Referenceabstract

#include <pool.h>

Public Member Functions

constexpr Pool (const Capabilities &capabilities, const Layout &layout)
 
const Layoutlayout () const
 
void * Allocate ()
 
- Public Member Functions inherited from pw::Deallocator
const Capabilitiescapabilities () const
 
bool HasCapability (Capability capability) const
 Returns whether a given capabilityis enabled for this object.
 
void Deallocate (void *ptr)
 
void Deallocate (void *ptr, Layout layout)
 
template<typename T >
void Delete (T *ptr)
 
StatusWithSize GetCapacity () const
 
bool IsEqual (const Deallocator &other) const
 

Additional Inherited Members

- Public Types inherited from pw::Deallocator
using Capabilities = allocator::Capabilities
 
using Capability = allocator::Capability
 
using Layout = allocator::Layout
 
- Protected Member Functions inherited from pw::Deallocator
constexpr Deallocator ()=default
 TODO(b/326509341): Remove when downstream consumers migrate.
 
constexpr Deallocator (const Capabilities &capabilities)
 
template<typename T >
UniquePtr< T > WrapUnique (T *ptr)
 

Detailed Description

Abstract interface for fixed-layout memory allocation.

The interface makes no guarantees about its implementation. Consumers of the generic interface must not make any assumptions around allocator behavior, thread safety, or performance.

Member Function Documentation

◆ Allocate()

void * pw::allocator::Pool::Allocate ( )
inline

Returns a chunk of memory with this object's fixed layout.

Like pw::allocator::Allocate, returns null if memory is exhausted.

Return values
Theallocated memory.

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