mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
fix the nomalloc test: it didn't catch the ei_stack_alloc in
cachefriendlyproduct, that should be banned as well as depending on the platform they can give a malloc, and they could happen even with (large enough) fixed size matrices. Corresponding fix in Product.h: cachefriendly is now only used for dynamic matrices -- fixedsize, no matter how large, doesn't use the cachefriendly product. We don't need to care (in my opinion) about performance for large fixed size, as large fixed size is a bad idea in the first place and it is more important to be able to guarantee clearly that fixed size never causes a malloc.
This commit is contained in:
@@ -25,8 +25,11 @@
|
||||
|
||||
// this hack is needed to make this file compiles with -pedantic (gcc)
|
||||
#define throw(X)
|
||||
// discard vectorization since operator new is not called in that case
|
||||
// discard vectorization since the global operator new is not called in that case
|
||||
#define EIGEN_DONT_VECTORIZE 1
|
||||
// discard stack allocation as that too bypasses the global operator new
|
||||
#define EIGEN_STACK_ALLOCATION_LIMIT 0
|
||||
|
||||
#include "main.h"
|
||||
|
||||
void* operator new[] (size_t n)
|
||||
@@ -84,4 +87,5 @@ void test_nomalloc()
|
||||
VERIFY_RAISES_ASSERT(MatrixXd dummy = MatrixXd::Random(3,3));
|
||||
CALL_SUBTEST( nomalloc(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( nomalloc(Matrix4d()) );
|
||||
CALL_SUBTEST( nomalloc(Matrix<float,32,32>()) );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user