class ArrayRecycler

Declaration

template <class T, size_t Align = alignof(type - parameter - 0 - 0)>
class ArrayRecycler { /* full declaration omitted */ };

Description

Recycle small arrays allocated from a BumpPtrAllocator. Arrays are allocated in a small number of fixed sizes. For each supported array size, the ArrayRecycler keeps a free list of available arrays.

Declared at: llvm/include/llvm/Support/ArrayRecycler.h:28

Templates

T
size_t Align = alignof(type-parameter-0-0)

Method Overview

  • public template <class AllocatorType>T * allocate(llvm::ArrayRecycler::Capacity Cap, AllocatorType & Allocator)
  • public void clear(llvm::BumpPtrAllocator &)
  • public template <class AllocatorType>void clear(AllocatorType & Allocator)
  • public void deallocate(llvm::ArrayRecycler::Capacity Cap, T * Ptr)
  • public ~ArrayRecycler<T, Align>()

Methods

template <class AllocatorType>
T* allocate(llvm::ArrayRecycler::Capacity Cap,
            AllocatorType& Allocator)

Description

Allocate an array of at least the requested capacity. Return an existing recycled array, or allocate one from Allocator if none are available for recycling.

Declared at: llvm/include/llvm/Support/ArrayRecycler.h:125

Templates

AllocatorType

Parameters

llvm::ArrayRecycler::Capacity Cap
AllocatorType& Allocator

void clear(llvm::BumpPtrAllocator&)

Description

Special case for BumpPtrAllocator which has an empty Deallocate() function. There is no need to traverse the free lists, pulling all the objects into cache.

Declared at: llvm/include/llvm/Support/ArrayRecycler.h:115

Parameters

llvm::BumpPtrAllocator&

template <class AllocatorType>
void clear(AllocatorType& Allocator)

Description

Release all the tracked allocations to the allocator. The recycler must be free of any tracked allocations before being deleted.

Declared at: llvm/include/llvm/Support/ArrayRecycler.h:104

Templates

AllocatorType

Parameters

AllocatorType& Allocator

void deallocate(llvm::ArrayRecycler::Capacity Cap,
                T* Ptr)

Description

Deallocate an array with the specified Capacity. Cap must be the same capacity that was given to allocate().

Declared at: llvm/include/llvm/Support/ArrayRecycler.h:137

Parameters

llvm::ArrayRecycler::Capacity Cap
T* Ptr

~ArrayRecycler<T, Align>()

Declared at: llvm/include/llvm/Support/ArrayRecycler.h:95