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
|
#define EIGEN_RESTRICT __restrict
|
||||||
|
|
||||||
|
#ifndef EIGEN_STACK_ALLOCATION_LIMIT
|
||||||
|
#define EIGEN_STACK_ALLOCATION_LIMIT 16000000
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef EIGEN_DEFAULT_IO_FORMAT
|
#ifndef EIGEN_DEFAULT_IO_FORMAT
|
||||||
#define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat()
|
#define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat()
|
||||||
#endif
|
#endif
|
||||||
|
@ -143,11 +143,12 @@ inline static int ei_alignmentOffset(const Scalar* ptr, int maxOffset)
|
|||||||
* \endcode
|
* \endcode
|
||||||
*/
|
*/
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
# define ei_alloc_stack(TYPE,SIZE) ((sizeof(TYPE)*(SIZE)>16000000) ? new TYPE[SIZE] : (TYPE*)alloca(sizeof(TYPE)*(SIZE)))
|
#define ei_alloc_stack(TYPE,SIZE) ((sizeof(TYPE)*(SIZE)>EIGEN_STACK_ALLOCATION_LIMIT) ? \
|
||||||
# define ei_free_stack(PTR,TYPE,SIZE) if (sizeof(TYPE)*SIZE>16000000) delete[] PTR
|
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
|
#else
|
||||||
# define ei_alloc_stack(TYPE,SIZE) new TYPE[SIZE]
|
#define ei_alloc_stack(TYPE,SIZE) new TYPE[SIZE]
|
||||||
# define ei_free_stack(PTR,TYPE,SIZE) delete[] PTR
|
#define ei_free_stack(PTR,TYPE,SIZE) delete[] PTR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** \class WithAlignedOperatorNew
|
/** \class WithAlignedOperatorNew
|
||||||
|
Loading…
x
Reference in New Issue
Block a user