aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/nomalloc.cpp
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-01-08 15:20:21 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-01-08 15:20:21 +0000
commit1d52bd4cad64d8d8662f40c11210b705351b43ab (patch)
treec8fe83368e8e13ba7e8ec0c4ef078f5293cfea4d /test/nomalloc.cpp
parente2d2a7d2226b85569a9360b9738c15498fb454ac (diff)
the big memory changes. the most important changes are:
ei_aligned_malloc now really behaves like a malloc (untyped, doesn't call ctor) ei_aligned_new is the typed variant calling ctor EIGEN_MAKE_ALIGNED_OPERATOR_NEW now takes the class name as parameter
Diffstat (limited to 'test/nomalloc.cpp')
-rw-r--r--test/nomalloc.cpp21
1 files changed, 3 insertions, 18 deletions
diff --git a/test/nomalloc.cpp b/test/nomalloc.cpp
index be4c35c48..82119e9b3 100644
--- a/test/nomalloc.cpp
+++ b/test/nomalloc.cpp
@@ -25,28 +25,13 @@
// this hack is needed to make this file compiles with -pedantic (gcc)
#define throw(X)
-// 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
+// discard stack allocation as that too bypasses malloc
#define EIGEN_STACK_ALLOCATION_LIMIT 0
+// any heap allocation will raise an assert
+#define EIGEN_NO_MALLOC
#include "main.h"
-void* operator new[] (size_t n)
-{
- ei_assert(false && "operator new should never be called with fixed size path");
- // the following is in case assertion are disabled
- std::cerr << "operator new should never be called with fixed size path" << std::endl;
- exit(2);
- void* p = malloc(n);
- return p;
-}
-
-void operator delete[](void* p) throw()
-{
- free(p);
-}
-
template<typename MatrixType> void nomalloc(const MatrixType& m)
{
/* this test check no dynamic memory allocation are issued with fixed-size matrices