\(\newcommand{\W}[1]{ \; #1 \; }\) \(\newcommand{\R}[1]{ {\rm #1} }\) \(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} }\) \(\newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} }\) \(\newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} }\) \(\newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }\)
thread_alloc¶
View page sourceA Fast Multi-Threading Memory Allocator¶
Syntax¶
# include <cppad/thread_alloc.hpp>
Purpose¶
The C++ new
and delete
operators are thread safe,
but this means that a thread may have to wait for a lock on these operations.
Once memory is obtained for a thread, the thread_alloc
memory
allocator keeps that memory available for the thread so that
it can be re-used without waiting for a lock.
All the CppAD memory allocations use this utility.
The free_available function should be used to return memory
to the system (once it is no longer required by a thread).
Include¶
The routines in sections below are defined by cppad/thread_alloc.hpp
.
This file is included by
cppad/cppad.hpp
, but it can also be included separately with out
the rest of the CppAD
.
Contents¶
Name |
Title |
---|---|
thread_alloc.cpp |
|
ta_parallel_setup |
|
ta_num_threads |
|
ta_in_parallel |
|
ta_thread_num |
|
ta_get_memory |
|
ta_return_memory |
|
ta_free_available |
|
ta_hold_memory |
|
ta_inuse |
|
ta_available |
|
ta_create_array |
Allocate An Array and Call Default Constructor for its Elements |
ta_delete_array |
|
ta_free_all |