mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
actually honor EIGEN_STACK_ALLOCATION.
Can set it to 0 to disable stack alloc which guarantees that bad alloc throws exceptions if they are enabled.
This commit is contained in:
parent
38b83b4157
commit
2110cca431
@ -116,6 +116,10 @@ using Eigen::ei_cos;
|
||||
|
||||
#define EIGEN_RESTRICT __restrict
|
||||
|
||||
#ifndef EIGEN_STACK_ALLOCATION_LIMIT
|
||||
#define EIGEN_STACK_ALLOCATION_LIMIT 16000000
|
||||
#endif
|
||||
|
||||
#ifndef EIGEN_DEFAULT_IO_FORMAT
|
||||
#define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat()
|
||||
#endif
|
||||
|
@ -143,11 +143,12 @@ inline static int ei_alignmentOffset(const Scalar* ptr, int maxOffset)
|
||||
* \endcode
|
||||
*/
|
||||
#ifdef __linux__
|
||||
# define ei_alloc_stack(TYPE,SIZE) ((sizeof(TYPE)*(SIZE)>16000000) ? new TYPE[SIZE] : (TYPE*)alloca(sizeof(TYPE)*(SIZE)))
|
||||
# define ei_free_stack(PTR,TYPE,SIZE) if (sizeof(TYPE)*SIZE>16000000) delete[] PTR
|
||||
#define ei_alloc_stack(TYPE,SIZE) ((sizeof(TYPE)*(SIZE)>EIGEN_STACK_ALLOCATION_LIMIT) ? \
|
||||
new TYPE[SIZE] : (TYPE*)alloca(sizeof(TYPE)*(SIZE)))
|
||||
#define ei_free_stack(PTR,TYPE,SIZE) if (sizeof(TYPE)*SIZE>EIGEN_STACK_ALLOCATION_LIMIT) delete[] PTR
|
||||
#else
|
||||
# define ei_alloc_stack(TYPE,SIZE) new TYPE[SIZE]
|
||||
# define ei_free_stack(PTR,TYPE,SIZE) delete[] PTR
|
||||
#define ei_alloc_stack(TYPE,SIZE) new TYPE[SIZE]
|
||||
#define ei_free_stack(PTR,TYPE,SIZE) delete[] PTR
|
||||
#endif
|
||||
|
||||
/** \class WithAlignedOperatorNew
|
||||
|
Loading…
x
Reference in New Issue
Block a user