Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ alloc()

void * stan::math::stack_alloc::alloc ( size_t  len,
size_t  alignment = 8 
)
inline

Return a newly allocated block of memory of the appropriate size managed by the stack allocator.

The allocated pointer will be aligned to alignment bytes, and at least 8 bytes. If the number of bytes requested is not a multiple of 8, the reserved space will be padded up to the next multiple of 8.

This function may call C++'s malloc() function, with any exceptions percolated through this function.

Parameters
lenNumber of bytes to allocate.
alignmentAlignment in bytes, a power of two.
Returns
A pointer to the allocated memory.

Definition at line 186 of file stack_alloc.hpp.