1 // Copyright Antony Polukhin, 2018. 2 // 3 // Distributed under the Boost Software License, Version 1.0. (See 4 // accompanying file LICENSE_1_0.txt or copy at 5 // http://www.boost.org/LICENSE_1_0.txt) 6 7 8 // This file tests for memory leaks. Some of the backtrace implementations 9 // consume memory for internal needs and incorrect usage of those implementations 10 // could lead to segfaults. Sanitizers do not detect such misuse, but this 11 // test and `top` does. 12 13 14 #include <boost/stacktrace.hpp> 15 #include <iostream> 16 17 #include "test_impl.hpp" 18 main()19int main() { 20 int result = 0; 21 for (unsigned i = 0; i < 10000000; ++i) { 22 result += make_some_stacktrace1()[0].source_line(); 23 } 24 25 std::cerr << "OK\nLines count " << result; 26 } 27