Commit Graph

6 Commits

Author SHA1 Message Date
Gael Guennebaud
572d62697d check two ctors 2018-11-23 15:37:09 +01:00
Gael Guennebaud
82f0ce2726 Get rid of EIGEN_TEST_FUNC, unit tests must now be declared with EIGEN_DECLARE_TEST(mytest) { /* code */ }.
This provide several advantages:
- more flexibility in designing unit tests
- unit tests can be glued to speed up compilation
- unit tests are compiled with same predefined macros, which is a requirement for zapcc
2018-07-17 14:46:15 +02:00
Christoph Hertzberg
3be9f5c4d7 Constructing a Matrix/Array with implicit transpose could lead to memory leaks.
Also reduced code duplication for Matrix/Array constructors
2015-04-16 13:25:20 +02:00
Christoph Hertzberg
a8283e0ed2 Define EIGEN_TRY, EIGEN_CATCH, EIGEN_THROW as suggested by Moritz Klammer.
Make it possible to run unit-tests with exceptions disabled via EIGEN_TEST_NO_EXCEPTIONS flag.
Enhanced ctorleak unit-test
2014-07-22 13:16:44 +02:00
Moritz Klammler
529e6cb552 Applied changes suggested by Christoph Hertzberg to c'tor leak fix.
- Enclose exception handling in '#ifdef EIGEN_EXCEPTIONS'.
- Use an object counter to demonstrate the bug more readily.
2014-07-18 23:19:56 +02:00
Moritz Klammler
58687aa5e6 Avoid memory leak when constructor of user-defined type throws exception.
The added check `ctorleak.cpp` demonstrates how the leak can be reproduced.
The test appears to pass but it is leaking the storage of the (not created)
matrix.  I don't know how to make this test fail in the existing test suite but
you can run it through Valgrind (or another debugger) to verify the leak.

    $ ./check.sh ctorleak && valgrind --leak-check=full ./test/ctorleak

This patch fixes this leak by adding some try-catch-delete-rethrow blocks to
`Eigen/src/Core/util/Memory.h`.
2014-07-06 06:58:13 +02:00