Commit Graph

4 Commits

Author SHA1 Message Date
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