/* $Id: omp_alloc.omh 3607 2015-01-20 16:20:41Z bradbell $ */ /* -------------------------------------------------------------------------- CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell CppAD is distributed under multiple licenses. This distribution is under the terms of the Eclipse Public License Version 1.0. A copy of this license is included in the COPYING file of this distribution. Please visit http://www.coin-or.org/CppAD/ for information on other licenses. -------------------------------------------------------------------------- */ $begin omp_alloc$$ $spell openmp cppad/omp_alloc.hpp CppAD $$ $section A Quick OpenMP Memory Allocator Used by CppAD$$ $index multi-threading, memory allocation$$ $index openmp, memory allocation$$ $index memory, multi-threading allocation$$ $index allocation, multi-threading$$ $head Syntax$$ $code # include $$ $head Purpose$$ The C++ $code new$$ and $code 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 $code omp_alloc$$ memory allocator keeps that memory $cref omp_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 $cref omp_free_available$$ function should be used to return memory to the system (once it is no longer required by a thread). $head Include$$ The routines in sections below are defined by $code cppad/omp_alloc.hpp$$. This file is included by $code cppad/cppad.hpp$$, but it can also be included separately with out the rest of the $code CppAD$$. $head Deprecated 2011-08-23$$ Use $cref thread_alloc$$ instead. $childtable% cppad/omp_alloc.hpp% example/omp_alloc.cpp %$$ $end */