Un-typesafe base class for maintaining a free-list memory pool. More...
#include <CUDA/cudafreelist.H>
Classes | |
struct | node |
Free-node class for free-list memory pools. | |
Public Member Functions | |
cuda_free_list_base (std::size_t size_check) | |
Construct an (empty) free list. | |
void * | allocate (std::size_t bytes, int dev) |
Allocate space for a new object. | |
void | deallocate (void *space, int dev) |
Return an object to the free list. | |
void | release_free_nodes () |
Release all nodes currently on the free list (e.g. to conserve memory). | |
int | get_num_nodes (int dev) |
std::map< int, int > ::const_iterator | getDevicesBegin () |
std::map< int, int > ::const_iterator | getDevicesEnd () |
std::size_t | alloc_size () const |
Query the chunk size that this freelist is for. | |
std::size_t | num_allocations (int dev) |
Query how many allocations have been made. |
Un-typesafe base class for maintaining a free-list memory pool.
Definition at line 49 of file cudafreelist.H.
rutz::cuda_free_list_base::cuda_free_list_base | ( | std::size_t | size_check | ) |
Construct an (empty) free list.
All objects from this list must be of size size_check.
Definition at line 42 of file cudafreelist.C.
std::size_t rutz::cuda_free_list_base::alloc_size | ( | ) | const [inline] |
Query the chunk size that this freelist is for.
Definition at line 94 of file cudafreelist.H.
void * rutz::cuda_free_list_base::allocate | ( | std::size_t | bytes, | |
int | dev | |||
) |
Allocate space for a new object.
If there are chunks available in the free list, one of those is returned; otherwise new memory is allocated with malloc() or equivalent.
Definition at line 52 of file cudafreelist.C.
References ASSERT.
void rutz::cuda_free_list_base::deallocate | ( | void * | space, | |
int | dev | |||
) |
Return an object to the free list.
Definition at line 73 of file cudafreelist.C.
std::size_t rutz::cuda_free_list_base::num_allocations | ( | int | dev | ) | [inline] |
Query how many allocations have been made.
Definition at line 97 of file cudafreelist.H.
void rutz::cuda_free_list_base::release_free_nodes | ( | ) |
Release all nodes currently on the free list (e.g. to conserve memory).
Definition at line 119 of file cudafreelist.C.
Referenced by rutz::cuda_free_list< T >::release_free_nodes().