Giter VIP home page Giter VIP logo

Comments (8)

arkadesOrg avatar arkadesOrg commented on August 26, 2024

With cmake I had to add the definition to use shared libraries for my specific use case:

set_target_properties(my_test PROPERTIES COMPILE_DEFINITIONS "BOOST_TEST_DYN_LINK")

Thanks for this awesome Boost framework!

from test.

tranqui avatar tranqui commented on August 26, 2024

I get the same error, also on arch with boost 1.83.0. However, setting BOOST_TEST_DYN_LINK did not fix it in my case.

from test.

arkadesOrg avatar arkadesOrg commented on August 26, 2024

Did you also try to set up a very basic test case?

from test.

tranqui avatar tranqui commented on August 26, 2024

Yes, mine was essentially identical to yours just with different filenames.

I also tried direct compilation with g++ -o unit_test unit_test.cc -lboost_unit_test_framework with the same memory leak. Here unit_test.cc could be your code snippet to reproduce the error.

from test.

arkadesOrg avatar arkadesOrg commented on August 26, 2024

I see, so you generelly link with cmake, but also tried to directly do it. Should'nt you have passed the -DBOOST_TEST_DYN_LINK defintion to g++?

PS: do you have a similar valgrind output?

from test.

tranqui avatar tranqui commented on August 26, 2024

Ah, yeah I just manually placed the #define BOOST_TEST_DYN_LINK inside the cpp file for the manual compilation.

Yes re: similar valgrind output:

==90488== Invalid free() / delete / delete[] / realloc()
==90488==    at 0x48468BD: operator delete(void*, unsigned long) (vg_replace_malloc.c:1181)
==90488==    by 0x4D0BA5F: __cxa_finalize (cxa_finalize.c:82)
==90488==    by 0x48BE2F7: ??? (in /usr/lib/libboost_unit_test_framework.so.1.83.0)
==90488==    by 0x40010F1: _dl_call_fini (dl-call_fini.c:43)
==90488==    by 0x400511D: _dl_fini (dl-fini.c:114)
==90488==    by 0x4D0BFA0: __run_exit_handlers (exit.c:108)
==90488==    by 0x4D0C06D: exit (exit.c:138)
==90488==    by 0x4CF2C8E: (below main) (libc_start_call_main.h:74)
==90488==  Address 0x4ed17c0 is 0 bytes inside a block of size 18 free'd
==90488==    at 0x4846404: operator delete(void*) (vg_replace_malloc.c:1131)
==90488==    by 0x4D0BFA0: __run_exit_handlers (exit.c:108)
==90488==    by 0x4D0C06D: exit (exit.c:138)
==90488==    by 0x4CF2C8E: (below main) (libc_start_call_main.h:74)
==90488==  Block was alloc'd at
==90488==    at 0x4842F73: operator new(unsigned long) (vg_replace_malloc.c:487)
==90488==    by 0x180DA5: void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*, std::forward_iterator_tag) (in /home/joshua/unit_test)
==90488==    by 0x16D8F9: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string<std::allocator<char> >(char const*, std::allocator<char> const&) (in /home/joshua/unit_test)
==90488==    by 0x1547FF: __static_initialization_and_destruction_0() (in /home/joshua/unit_test)
==90488==    by 0x15501D: _GLOBAL__sub_I__ZN5boost9unit_test6output22compiler_log_formatter9log_startERSom (in /home/joshua/unit_test)
==90488==    by 0x4CF2DC3: call_init (libc-start.c:145)
==90488==    by 0x4CF2DC3: __libc_start_main@@GLIBC_2.34 (libc-start.c:347)
==90488==    by 0x121C04: (below main) (in /home/joshua/unit_test)

And compiling with -fsanitize=leak:

==90960==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 23 byte(s) in 1 object(s) allocated from:
    #0 0x78944c0fd682 in operator new(unsigned long) /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_new_delete.cpp:95
    #1 0x78944bf9269e  (/usr/lib/libboost_unit_test_framework.so.1.83.0+0x2769e) (BuildId: c157e439137327cbc19d9c2cfa9936099dbf1f09)
    #2 0x78944bf8df12  (/usr/lib/libboost_unit_test_framework.so.1.83.0+0x22f12) (BuildId: c157e439137327cbc19d9c2cfa9936099dbf1f09)
    #3 0x78944c72d2e6  (/lib64/ld-linux-x86-64.so.2+0x52e6) (BuildId: c560bca2bb17f5f25c6dafd8fc19cf1883f88558)
    #4 0x78944c72d3dc  (/lib64/ld-linux-x86-64.so.2+0x53dc) (BuildId: c560bca2bb17f5f25c6dafd8fc19cf1883f88558)
    #5 0x78944c74479f  (/lib64/ld-linux-x86-64.so.2+0x1c79f) (BuildId: c560bca2bb17f5f25c6dafd8fc19cf1883f88558)

Direct leak of 21 byte(s) in 1 object(s) allocated from:
    #0 0x78944c0fd682 in operator new(unsigned long) /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_new_delete.cpp:95
    #1 0x78944bf9269e  (/usr/lib/libboost_unit_test_framework.so.1.83.0+0x2769e) (BuildId: c157e439137327cbc19d9c2cfa9936099dbf1f09)
    #2 0x78944bf8dd32  (/usr/lib/libboost_unit_test_framework.so.1.83.0+0x22d32) (BuildId: c157e439137327cbc19d9c2cfa9936099dbf1f09)
    #3 0x78944c72d2e6  (/lib64/ld-linux-x86-64.so.2+0x52e6) (BuildId: c560bca2bb17f5f25c6dafd8fc19cf1883f88558)
    #4 0x78944c72d3dc  (/lib64/ld-linux-x86-64.so.2+0x53dc) (BuildId: c560bca2bb17f5f25c6dafd8fc19cf1883f88558)
    #5 0x78944c74479f  (/lib64/ld-linux-x86-64.so.2+0x1c79f) (BuildId: c560bca2bb17f5f25c6dafd8fc19cf1883f88558)

Direct leak of 20 byte(s) in 1 object(s) allocated from:
    #0 0x78944c0fd682 in operator new(unsigned long) /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_new_delete.cpp:95
    #1 0x78944bf9269e  (/usr/lib/libboost_unit_test_framework.so.1.83.0+0x2769e) (BuildId: c157e439137327cbc19d9c2cfa9936099dbf1f09)
    #2 0x78944bf8dd5a  (/usr/lib/libboost_unit_test_framework.so.1.83.0+0x22d5a) (BuildId: c157e439137327cbc19d9c2cfa9936099dbf1f09)
    #3 0x78944c72d2e6  (/lib64/ld-linux-x86-64.so.2+0x52e6) (BuildId: c560bca2bb17f5f25c6dafd8fc19cf1883f88558)
    #4 0x78944c72d3dc  (/lib64/ld-linux-x86-64.so.2+0x53dc) (BuildId: c560bca2bb17f5f25c6dafd8fc19cf1883f88558)
    #5 0x78944c74479f  (/lib64/ld-linux-x86-64.so.2+0x1c79f) (BuildId: c560bca2bb17f5f25c6dafd8fc19cf1883f88558)

Direct leak of 20 byte(s) in 1 object(s) allocated from:
    #0 0x78944c0fd682 in operator new(unsigned long) /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_new_delete.cpp:95
    #1 0x78944bf9269e  (/usr/lib/libboost_unit_test_framework.so.1.83.0+0x2769e) (BuildId: c157e439137327cbc19d9c2cfa9936099dbf1f09)
    #2 0x78944bf8dce2  (/usr/lib/libboost_unit_test_framework.so.1.83.0+0x22ce2) (BuildId: c157e439137327cbc19d9c2cfa9936099dbf1f09)
    #3 0x78944c72d2e6  (/lib64/ld-linux-x86-64.so.2+0x52e6) (BuildId: c560bca2bb17f5f25c6dafd8fc19cf1883f88558)
    #4 0x78944c72d3dc  (/lib64/ld-linux-x86-64.so.2+0x53dc) (BuildId: c560bca2bb17f5f25c6dafd8fc19cf1883f88558)
    #5 0x78944c74479f  (/lib64/ld-linux-x86-64.so.2+0x1c79f) (BuildId: c560bca2bb17f5f25c6dafd8fc19cf1883f88558)

Direct leak of 18 byte(s) in 1 object(s) allocated from:
    #0 0x78944c0fd682 in operator new(unsigned long) /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_new_delete.cpp:95
    #1 0x78944bf9269e  (/usr/lib/libboost_unit_test_framework.so.1.83.0+0x2769e) (BuildId: c157e439137327cbc19d9c2cfa9936099dbf1f09)
    #2 0x78944bf8e02a  (/usr/lib/libboost_unit_test_framework.so.1.83.0+0x2302a) (BuildId: c157e439137327cbc19d9c2cfa9936099dbf1f09)
    #3 0x78944c72d2e6  (/lib64/ld-linux-x86-64.so.2+0x52e6) (BuildId: c560bca2bb17f5f25c6dafd8fc19cf1883f88558)
    #4 0x78944c72d3dc  (/lib64/ld-linux-x86-64.so.2+0x53dc) (BuildId: c560bca2bb17f5f25c6dafd8fc19cf1883f88558)
    #5 0x78944c74479f  (/lib64/ld-linux-x86-64.so.2+0x1c79f) (BuildId: c560bca2bb17f5f25c6dafd8fc19cf1883f88558)

SUMMARY: AddressSanitizer: 102 byte(s) leaked in 5 allocation(s).

I suspect this is an arch linux problem rather than a boost problem.

I also tried to statically link the boost libraries, but got multiple definition linker errors.

from test.

arkadesOrg avatar arkadesOrg commented on August 26, 2024

#define BOOST_TEST_DYN_LINK is exactly what I tried also, but -DBOOST_TEST_DYN_LINK did the trick for some reason. I build on arch linux, and the testcases now exit properly.

from test.

tranqui avatar tranqui commented on August 26, 2024

I have tried both to no avail.

from test.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.