class nanoflann::PooledAllocator

#include <nanoflann.hpp>

class PooledAllocator
{
public:
    //
fields

    size_t usedMemory;
    size_t wastedMemory;

    //
methods

    void free_all();
    void* malloc(const size_t req_size);

    template <typename T>
    T* allocate(const size_t count = 1);
};

Methods

void free_all()

Frees all allocated memory chunks.

void* malloc(const size_t req_size)

Returns a pointer to a piece of new memory of the given size in bytes allocated from the pool.

template <typename T>
T* allocate(const size_t count = 1)

Allocates (using this pool) a generic type T.

Params: count = number of instances to allocate. Returns: pointer (of type T*) to memory buffer