Stan Math Library  2.14.0
reverse mode automatic differentiation
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 
7 #include <stdexcept>
8 
9 namespace stan {
10  namespace math {
11 
18  static inline void recover_memory() {
19  if (!empty_nested())
20  throw std::logic_error("empty_nested() must be true"
21  " before calling recover_memory()");
24  for (size_t i = 0; i < ChainableStack::var_alloc_stack_.size(); ++i) {
26  }
29  }
30 
31  }
32 }
33 #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–2016, Stan Development Team.