Stan Math Library  2.8.0
reverse mode automatic differentiation
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
recover_memory.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_CORE_RECOVER_MEMORY_HPP
2 #define STAN_MATH_REV_CORE_RECOVER_MEMORY_HPP
3 
8 #include <stdexcept>
9 
10 namespace stan {
11  namespace math {
12 
19  static inline void recover_memory() {
20  if (!empty_nested())
21  throw std::logic_error("empty_nested() must be true"
22  " before calling recover_memory()");
25  for (size_t i = 0; i < ChainableStack::var_alloc_stack_.size(); ++i) {
27  }
30  }
31 
32  }
33 }
34 #endif
static bool empty_nested()
Return true if there is no nested autodiff being executed.
void recover_all()
Recover all the memory used by the stack allocator.
static std::vector< ChainableAllocT * > var_alloc_stack_
static std::vector< ChainableT * > var_nochain_stack_
static void recover_memory()
Recover memory used for all variables for reuse.
static std::vector< ChainableT * > var_stack_

     [ Stan Home Page ] © 2011–2015, Stan Development Team.