ConcurrentVectorMemoryPool#
Fully qualified name: usd_optimize::ConcurrentVectorMemoryPool
Classes Summary#
- Vec
Scoped wrapper around a memory pool allocated vector. This means the vector is deallocated when the wrapper goes out of scope.
-
template<typename T>
class ConcurrentVectorMemoryPool# Manages a pool of vectors of type T that can be accessed concurrently. If there are no free vectors available, a new one is allocated. Note: this does not garbage collect, the destructor or clear must be called to release memory.
Public Functions
-
inline ConcurrentVectorMemoryPool(bool active)#
-
inline ~ConcurrentVectorMemoryPool()#
-
ConcurrentVectorMemoryPool(const ConcurrentVectorMemoryPool&) = delete#
- ConcurrentVectorMemoryPool &operator=(
- const ConcurrentVectorMemoryPool&,
-
inline void setActive(bool active)#
Sets whether this memory pool is active or not. If it is not active, then all vectors are allocated directly and not from the pool note: this function calls
clearso it is not thread safe and should only be called when no other threads are using the pool.
-
inline Vec allocate(size_t size = 0)#
Either allocates a new vector or returns an existing one from the pool.
- Parameters:
size – The minimum size that the vector should have of reserved memory.
-
inline void clear()#
Frees all vectors in the pool. Warning: Calling clear is not thread safe and should only be called when no other threads are using the pool.
Protected Functions
-
class Vec#
Scoped wrapper around a memory pool allocated vector. This means the vector is deallocated when the wrapper goes out of scope.
Public Functions
-
inline ~Vec()#
Protected Functions
- inline Vec(
- ConcurrentVectorMemoryPool &memPool,
- std::vector<T> *vec,
Friends
- friend class ConcurrentVectorMemoryPool
-
inline ~Vec()#
-
inline ConcurrentVectorMemoryPool(bool active)#