MRPT  2.0.1
List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
nanoflann::PooledAllocator Class Reference

Detailed Description

Definition at line 462 of file nanoflann.hpp.

#include <nanoflann.hpp>

Public Member Functions

 PooledAllocator ()
 Default constructor. More...
 
 ~PooledAllocator ()
 Destructor. More...
 
void free_all ()
 Frees all allocated memory chunks. More...
 
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. More...
 
template<typename T >
T * allocate (const size_t count=1)
 Allocates (using this pool) a generic type T. More...
 

Public Attributes

size_t usedMemory
 
size_t wastedMemory
 

Private Member Functions

void internal_init ()
 

Private Attributes

size_t remaining
 
void * base
 
void * loc
 

Constructor & Destructor Documentation

◆ PooledAllocator()

nanoflann::PooledAllocator::PooledAllocator ( )
inline

Default constructor.

Initializes a new pool.

Definition at line 489 of file nanoflann.hpp.

◆ ~PooledAllocator()

nanoflann::PooledAllocator::~PooledAllocator ( )
inline

Destructor.

Frees all the memory allocated in this pool.

Definition at line 496 of file nanoflann.hpp.

Member Function Documentation

◆ allocate()

template<typename T >
T* nanoflann::PooledAllocator::allocate ( const size_t  count = 1)
inline

Allocates (using this pool) a generic type T.

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

Definition at line 568 of file nanoflann.hpp.

References nanoflann::KNNResultSet< DistanceType, IndexType, CountType >::count.

Referenced by nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::divideTree(), and nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::load_tree().

Here is the caller graph for this function:

◆ free_all()

void nanoflann::PooledAllocator::free_all ( )
inline

Frees all allocated memory chunks.

Definition at line 501 of file nanoflann.hpp.

Referenced by nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::freeIndex().

Here is the caller graph for this function:

◆ internal_init()

void nanoflann::PooledAllocator::internal_init ( )
inlineprivate

Definition at line 474 of file nanoflann.hpp.

◆ malloc()

void* nanoflann::PooledAllocator::malloc ( const size_t  req_size)
inline

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

Definition at line 515 of file nanoflann.hpp.

References nanoflann::BLOCKSIZE, mrpt::system::os::fprintf(), nanoflann::KNNResultSet< DistanceType, IndexType, CountType >::size(), and nanoflann::WORDSIZE.

Here is the call graph for this function:

Member Data Documentation

◆ base

void* nanoflann::PooledAllocator::base
private

Definition at line 471 of file nanoflann.hpp.

◆ loc

void* nanoflann::PooledAllocator::loc
private

Definition at line 472 of file nanoflann.hpp.

◆ remaining

size_t nanoflann::PooledAllocator::remaining
private

Definition at line 470 of file nanoflann.hpp.

◆ usedMemory

size_t nanoflann::PooledAllocator::usedMemory

◆ wastedMemory

size_t nanoflann::PooledAllocator::wastedMemory



Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020