Help save net neutrality! Learn more.
Close

leak problem?

Help
siugar
2007-04-16
2013-04-22
  • siugar

    siugar - 2007-04-16

    Hi,
    It seems there is the leak problem. When CPPUNIT_ASSERT gets false, the whole function will not continue and the destructor of the local variable in that function won't be called. It causes out of resource after running some functions. Does anyone know how to solve it?

     
  • Michael Breuer

    Michael Breuer - 2010-01-21

    Using Visual C++ 2008

    I get the following by using makros

    Detected memory leaks!
    Dumping objects ->
    {2059} normal block at 0x00D2F870, 32 bytes long.
    Data: <SystemInformatio> 53 79 73 74 65 6D 49 6E 66 6F 72 6D 61 74 69 6F
    Object dump complete.
    Das Programm " TcmsUnitTest.exe: Systemeigen" wurde mit Code 0 (0x0) beendet.

    this is my testsuite (the leak occurs with this empty suite)
    CPPUNIT_TEST_SUITE( SystemInformationInterfaceTest );
    CPPUNIT_TEST_SUITE_END();

    Stackanalysis with breakpoint at 2059:
    msvcr90d.dll!_heap_alloc_dbg_impl(unsigned int nSize=32, int nBlockUse=1, const char * szFileName=0x00000000, int nLine=0, int * errno_tmp=0x0013f73c)  Zeile 387 C++
    msvcr90d.dll!_nh_malloc_dbg_impl(unsigned int nSize=32, int nhFlag=0, int nBlockUse=1, const char * szFileName=0x00000000, int nLine=0, int * errno_tmp=0x0013f73c)  Zeile 239 + 0x19 Bytes C++
    msvcr90d.dll!_nh_malloc_dbg(unsigned int nSize=32, int nhFlag=0, int nBlockUse=1, const char * szFileName=0x00000000, int nLine=0)  Zeile 296 + 0x1d Bytes C++
    msvcr90d.dll!malloc(unsigned int nSize=32)  Zeile 56 + 0x15 Bytes C++
    > msvcr90d.dll!operator new(unsigned int size=32)  Zeile 59 + 0x9 Bytes C++
    msvcp90d.dll!std::_Allocate<char>(unsigned int _Count=32, char * __formal=0x00000000)  Zeile 43 + 0x9 Bytes C++
    msvcp90d.dll!std::allocator<char>::allocate(unsigned int _Count=32)  Zeile 151 + 0xb Bytes C++
    msvcp90d.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Copy(unsigned int _Newsize=30, unsigned int _Oldlen=0)  Zeile 2103 + 0x12 Bytes C++
    msvcp90d.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Grow(unsigned int _Newsize=30, bool _Trim=false)  Zeile 2133 + 0x13 Bytes C++
    msvcp90d.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & _Right="SystemInformationInterfaceTest", unsigned int _Roff=0, unsigned int _Count=4294967295)  Zeile 1065 + 0xe Bytes C++
    msvcp90d.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & _Right="SystemInformationInterfaceTest")  Zeile 1052 C++
    msvcp90d.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::operator=(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & _Right="SystemInformationInterfaceTest")  Zeile 927 C++
    TcmsUnitTest.exe!CppUnit::TestNamer::TestNamer(const type_info & typeInfo={…})  Zeile 12 + 0x3e Bytes C++
    TcmsUnitTest.exe!SystemInformationInterfaceTest::getTestNamer__()  Zeile 45 + 0x6a Bytes C++
    TcmsUnitTest.exe!SystemInformationInterfaceTest::suite()  Zeile 126 + 0x42 Bytes C++
    TcmsUnitTest.exe!main(int argc=1, char * * argv=0x003968a0)  Zeile 180 + 0x5 Bytes C++
    TcmsUnitTest.exe!__tmainCRTStartup()  Zeile 582 + 0x19 Bytes C
    TcmsUnitTest.exe!mainCRTStartup()  Zeile 399 C
    kernel32.dll!7c817067()

    TcmsUnitTest.exe!TiXmlPrinter::VisitEnter(const TiXmlElement & element={…}, const TiXmlAttribute * firstAttribute=0x7469726f)  Zeile 1772 + 0x8 Bytes C++
    6d657449()

    a similar Leak was created by
    CCUOGLOBIP_2Test
    renaming to CCUOGLOBIP2Test fixed the leak, - why  ????

    see also:
    https://sourceforge.net/projects/cppunit/forums/forum/37108/topic/3296943?message=7434345

     

Log in to post a comment.