aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/nomalloc.cpp
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-12-31 00:25:31 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-12-31 00:25:31 +0000
commitd671205755c3d9ee472eb1351d550d78f6d83454 (patch)
tree5d3783b20f246bc4a9db50d0f581d41cade169d7 /test/nomalloc.cpp
parent3958e7f751f48b2750f3e296cb737e04aec00821 (diff)
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.
Diffstat (limited to 'test/nomalloc.cpp')
-rw-r--r--test/nomalloc.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/nomalloc.cpp b/test/nomalloc.cpp
index c1683206d..be4c35c48 100644
--- a/test/nomalloc.cpp
+++ b/test/nomalloc.cpp
@@ -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>()) );
}