Prev Next Index-> contents reference index search external Up-> CppAD Appendix deprecated omp_alloc omp_efficient Appendix-> Faq directory Theory glossary Bib wish_list whats_new deprecated compare_c numeric_ad addon License deprecated-> include_deprecated FunDeprecated CompareChange omp_max_thread TrackNewDel omp_alloc memory_leak epsilon test_vector cppad_ipopt_nlp old_atomic zdouble autotools omp_alloc-> omp_max_num_threads omp_in_parallel omp_get_thread_num omp_get_memory omp_return_memory omp_free_available omp_inuse omp_available omp_create_array omp_delete_array omp_efficient old_max_num_threads omp_alloc.cpp omp_efficient Headings-> Removed Syntax Purpose v_ptr num_bytes flag Thread NDEBUG

Check If A Memory Allocation is Efficient for Another Use

Removed
This function has been removed because speed tests seem to indicate it is just as fast, or faster, to free and then reallocate the memory.

Syntax
# include <cppad/utility/omp_alloc.hpp>  flag = omp_alloc::efficient(v_ptr, num_bytes)

Purpose
Check if memory that is currently in use is an efficient allocation for a specified number of bytes.

v_ptr
This argument has prototype       const void* v_ptr  . It must be a pointer to memory that is currently in use; i.e. obtained by a previous call to omp_get_memory and not yet returned.

num_bytes
This argument has prototype       size_t num_bytes  It specifies the number of bytes of the memory allocated by v_ptr that we want to use.

flag
The return value has prototype       bool flag  It is true, a call to get_memory with min_bytes equal to num_bytes would result in a value for cap_bytes that is the same as when v_ptr was returned by get_memory; i.e., v_ptr is an efficient memory block for num_bytes bytes of information.

Thread
Either the current thread must be the same as during the corresponding call to omp_get_memory , or the current execution mode must be sequential (not parallel ).

NDEBUG
If NDEBUG is defined, v_ptr is not checked (this is faster). Otherwise, a list of in use pointers is searched to make sure that v_ptr is in the list.
Input File: cppad/utility/omp_alloc.hpp