Allocator implementations that don’t allocate memory directly and instead rely on other allocators while providing additional behaviors.
Learn more: Forwarding allocator concept
Classes | |
| class | pw::allocator::AllocatorAsPool |
Implementation of Pool that satisfies requests using an Allocator. More... | |
| class | pw::allocator::FallbackAllocator |
| class | pw::allocator::GuardedAllocator< BlockAllocatorType, LockType > |
| class | pw::allocator::PmrAllocator |
| class | pw::allocator::SynchronizedAllocator< LockType > |
| struct | pw::allocator::AddTrackingAllocatorAsChild |
| class | pw::allocator::TrackingAllocator< MetricsType > |
Typedefs | |
| using | pw::allocator::NoSync = pw::sync::NoLock |
Functions | |
| void * | pw::allocator::TrackingAllocator< MetricsType >::DoAllocate (Layout layout) override |
| void | pw::allocator::TrackingAllocator< MetricsType >::DoDeallocate (void *ptr) override |
| bool | pw::allocator::TrackingAllocator< MetricsType >::DoResize (void *ptr, size_t new_size) override |
| void | pw::allocator::TrackingAllocator< MetricsType >::DoBeforeReallocate (void *ptr, Layout new_layout) override |
| void | pw::allocator::TrackingAllocator< MetricsType >::DoAfterReallocateDone (Layout new_layout, void *new_ptr) override |
Variables | |
| static constexpr struct pw::allocator::AddTrackingAllocatorAsChild | pw::allocator::kAddTrackingAllocatorAsChild = {} |
| using pw::allocator::NoSync = typedef pw::sync::NoLock |
Tag type used to indicate synchronization is NOT desired.
This can be useful with allocator parameters for module configuration, e.g. PW_MALLOC_LOCK_TYPE.
|
overrideprivatevirtual |
Called as part of the default implementation of DoReallocate just before returning.
By default, does nothing. Derived types may implement this method to add additional behavior. If they do, they must call DoAfterReallocateDone on their base type before performing any other action.
new_ptr is guaranteed to be non-null, and new_layout.size() is guaranteed to be non-zero.
Reimplemented from pw::allocator::ForwardingAllocator.
|
overrideprivatevirtual |
Allocates a block of memory with the specified size and alignment.
Returns nullptr if the allocation cannot be made, or the layout has a size of 0.
| [in] | layout | Describes the memory to be allocated. |
Reimplemented from pw::allocator::ForwardingAllocator.
|
overrideprivatevirtual |
Called at the start of the default implementation of DoReallocate.
By default, does nothing. Derived types may implement this method to add additional behavior. If they do, they must call DoBeforeReallocate on their base type just before returning.
ptr is guaranteed to be non-null, and new_layout.size() is guaranteed to be non-zero.
Reimplemented from pw::allocator::ForwardingAllocator.
|
overrideprivatevirtual |
Releases a previously-allocated block of memory.
The given pointer must have been previously provided by this memory resource; otherwise the behavior is undefined.
| [in] | ptr | Pointer to previously-allocated memory. |
Reimplemented from pw::allocator::ForwardingAllocator.
|
overrideprivatevirtual |
Modifies the size of an previously-allocated block of memory without copying any data.
Returns true if its size was changed without copying data to a new allocation; otherwise returns false.
In particular, it always returns true if the old_layout.size() equals new_size, and always returns false if the given pointer is null, the old_layout.size() is 0, or the new_size is 0.
| [in] | ptr | Pointer to previously-allocated memory. |
| [in] | new_size | Requested new size for the memory allocation. |
Reimplemented from pw::allocator::ForwardingAllocator.