CppAD: A C++ Algorithmic Differentiation Package  20171217
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
CppAD::thread_alloc Class Reference

Capacity vector for memory allocation block sizes. More...

Classes

class  block_t
 
class  capacity_t
 
struct  thread_alloc_info
 Structure of information for each thread. More...
 

Static Public Member Functions

static size_t available (size_t thread)
 Determine the amount of memory that is currently available for use. More...
 
template<class Type >
static Type * create_array (size_t size_min, size_t &size_out)
 Use thread_alloc to allocate an array, then call default construtor for each element. More...
 
template<class Type >
static void delete_array (Type *array)
 Return Memory Used for an Array to the Available Pool (include destructor call for each element). More...
 
static bool free_all (void)
 Return to the system all thread_alloc memory that is not currently inuse. More...
 
static void free_available (size_t thread)
 Return all the memory being held as available for a thread to the system. More...
 
static void * get_memory (size_t min_bytes, size_t &cap_bytes)
 Use thread_alloc to get a specified amount of memory. More...
 
static void hold_memory (bool value)
 Change the thread_alloc hold memory setting. More...
 
static bool in_parallel (void)
 Are we in a parallel execution state; i.e., is it possible that other threads are currently executing. More...
 
static size_t inuse (size_t thread)
 Determine the amount of memory that is currently inuse. More...
 
static size_t num_threads (void)
 Get the current number of threads that thread_alloc can use. More...
 
static void parallel_setup (size_t num_threads, bool(*in_parallel)(void), size_t(*thread_num)(void))
 Set thread_alloc up for parallel mode usage. More...
 
static void return_memory (void *v_ptr)
 Return memory that was obtained by get_memory. More...
 
static size_t thread_num (void)
 Get current thread number. More...
 

Static Private Member Functions

static const capacity_tcapacity_info (void)
 Vector of fixed capacity values for this allocator. More...
 
static void dec_available (size_t dec, size_t thread)
 Decrease the number of bytes of memory that are currently avaialble; i.e., have been obtained obtained from the system and are being held future use. More...
 
static void dec_inuse (size_t dec, size_t thread)
 Decrease the number of bytes of memory that are currently in use; i.e., that been obtained with get_memory and not yet returned. More...
 
static void inc_available (size_t inc, size_t thread)
 Increase the number of bytes of memory that are currently avaialble; i.e., have been obtained obtained from the system and are being held future use. More...
 
static void inc_inuse (size_t inc, size_t thread)
 Increase the number of bytes of memory that are currently in use; i.e., that been obtained with get_memory and not yet returned. More...
 
static bool set_get_hold_memory (bool set, bool new_value=false)
 Set and Get hold available memory flag. More...
 
static size_t set_get_num_threads (size_t number_new)
 Set and get the number of threads that are sharing memory. More...
 
static size_t set_get_thread_num (size_t(*thread_num_new)(void), bool set=false)
 Set and call the routine that determine the current thread number. More...
 
static thread_alloc_infothread_info (size_t thread, bool clear=false)
 Get pointer to the information for this thread. More...
 

Detailed Description

Capacity vector for memory allocation block sizes.

Only one of these objects should be created and used as a static variable inside of the thread_alloc::capacity_info function.

Allocator class that works well with an multi-threading environment.

Definition at line 81 of file thread_alloc.hpp.


The documentation for this class was generated from the following file: