Archived

This forum has been archived. Please start a new discussion on GitHub.

Mismatched memory question

Good evening,

I downloaded the purify trial and ran it on one of my applications and it discovered lots of "freeing mismatched memory" problems. I have no idea how severe this message really is but could you please give a statement on that and whether it will be fixed in upcoming version?!

regs,

Stephan

Here goes the output of purify:

Starting Purify'd e:\develop\adaxis\aaclient\Release\aaclient.exe at 23.03.2005 21:52:43
Starting main
[E] FMM: Freeing mismatched memory in delete(void *) {3 occurrences}
Address 0x01e93c98 points into a malloc'd block in heap 0x01b40000
Location of free attempt
delete(void *) [.\build\intel\dll_obj\longjmp.obj:23]
Ice::argsToStringSeq(int,char * * const) [C:\WINDOWS\system32\ice21.dll]
_except_list [e:\develop\adaxis\aaclient\Release\aaclient.exe]
Allocation location
malloc [F:\VS70Builds\3052\vc\crtbld\crt\src\intel\memset.asm:53]
Ice::ObjectWriter::__write(BasicStream::IceInternal *)const [C:\WINDOWS\system32\ice21.dll]
IceInternal::IncomingBase::__warning(Exception::IceUtil const&)const [C:\WINDOWS\system32\ice21.dll]
_except_list [e:\develop\adaxis\aaclient\Release\aaclient.exe]
[E] FMM: Freeing mismatched memory in delete(void *) {18 occurrences}
Address 0x01e94ce8 points into a malloc'd block in heap 0x01b40000
Location of free attempt
delete(void *) [.\build\intel\dll_obj\longjmp.obj:23]
Ice::PropertiesI::parseCommandLineOptions(basic_string<char,char_traits<char>::std,allocator<char>::std>::std const&,vector<basic_string<char,char_traits<char>::std,allocator<char>::std>::std,allocator<basic_string<char,char_traits<char>::std,allocator<char>::std>::std>::std>::std const&) [C:\WINDOWS\system32\ice21.dll]
_except_list [e:\develop\adaxis\aaclient\Release\aaclient.exe]
Allocation location
malloc [F:\VS70Builds\3052\vc\crtbld\crt\src\intel\memset.asm:53]
Ice::ObjectWriter::__write(BasicStream::IceInternal *)const [C:\WINDOWS\system32\ice21.dll]
IceInternal::IncomingBase::__warning(Exception::IceUtil const&)const [C:\WINDOWS\system32\ice21.dll]
_except_list [e:\develop\adaxis\aaclient\Release\aaclient.exe]
[E] FMM: Freeing mismatched memory in delete(void *) {12 occurrences}
[E] FMM: Freeing mismatched memory in delete(void *) {1 occurrence}
[E] FMM: Freeing mismatched memory in delete(void *) {12 occurrences}
[E] FMM: Freeing mismatched memory in delete(void *) {1 occurrence}
[E] FMM: Freeing mismatched memory in delete(void *) {1 occurrence}
[E] FMM: Freeing mismatched memory in Ice::==(Plugin::Ice const&,Plugin::Ice const&) {1 occurrence}
[E] FMM: Freeing mismatched memory in Ice::==(Plugin::Ice const&,Plugin::Ice const&) {1 occurrence}
[E] FMM: Freeing mismatched memory in delete(void *) {1 occurrence}
Program terminated at 23.03.2005 21:52:59

Comments

  • bernard
    bernard Jupiter, FL
    I've also seen all these FMMs in release builds.

    I think it's because Purify needs debug info to work properly. Do you get these FMMs with a debug build? You could also try your own release build of Ice with debug info (in pdb files, i.e. with /Zi) ... we will consider making this the default.

    Cheers,
    Bernard
  • Which compiler is this? VC++ 6 or .NET?

    The reports are almost certainly bogus. Last time I purified, the code ran clean (but that was probably with a debug build). However, since we are not doing anything different with respect to memory management for debug and release builds, if it purifies cleanly in debug mode, it should purify cleanly in release mode.

    Cheers,

    Michi.
  • Hi again!

    I ran Purify on the debug version of the application as you suggested.

    However, I still find FMM messages and they are not fewer :(

    Do you see a possible impact on application stability?

    regs,

    Stephan



    Starting Purify'd e:\develop\adaxis\aaclient\debug\aaclient.exe at 24.03.2005 18:40:13
    Starting main
    [E] FMM: Freeing mismatched memory in delete(void *) {1 occurrence}
    [E] FMM: Freeing mismatched memory in delete(void *) {1 occurrence}
    [E] FMM: Freeing mismatched memory in delete(void *) {3 occurrences}
    [E] FMM: Freeing mismatched memory in delete(void *) {1 occurrence}
    Address 0x02496e80 points into a malloc'd block in heap 0x02400000
    Location of free attempt
    delete(void *) [f:\vs70builds\3077\vc\crtbld\crt\src\dbgdel.cpp:37]
    startHook [c:\builds\ice\src\iceutil\thread.cpp:203]
    threadstartex [f:\vs70builds\3077\vc\crtbld\crt\src\threadex.c:241]
    Allocation location
    malloc [f:\vs70builds\3077\vc\crtbld\crt\src\dbgheap.c:138]
    startHook [c:\builds\ice\src\iceutil\thread.cpp:203]
    threadstartex [f:\vs70builds\3077\vc\crtbld\crt\src\threadex.c:241]
    EXH: Handled exception in IceInternal::doConnect(UINT,sockaddr_in&,int) {19 occurrences}
    EXI: Ignored exception in Ice::ConnectionRefusedException::ice_throw(void)const {15 occurrences}
    EXH: Handled exception in Ice::ConnectionRefusedException::ice_throw(void)const {15 occurrences}
    EXI: Ignored exception in Ice::ConnectionRefusedException::ice_throw(void)const {10 occurrences}
    [E] FMM: Freeing mismatched memory in delete(void *) {10 occurrences}
    Address 0x024991f8 points into a malloc'd block in heap 0x02400000
    Location of free attempt
    delete(void *) [f:\vs70builds\3077\vc\crtbld\crt\src\dbgdel.cpp:37]
    @std@@QAEXPAU_Node@?$_Tree_nod@V?$_Tmap_traits@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@2@$0A@@2@I@Z [d:\msdev2003\vc7\include\xmemory.:132]
    std::_Tree<class std::_Tmap_traits<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,0> >::_Tidy(void) [d:\msdev2003\vc7\include\xtree.:1147]
    std::_Tree<class std::_Tmap_traits<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,0> >::~_Tree<class std::_Tmap_traits<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class std::basic_string<ch [d:\msdev2003\vc7\include\xtree.:392]
    ?2@@std@@QAE@XZ [e:\develop\adaxis\aaclient\debug\aaclient.exe]
    Ice::Current::~Current(void) [e:\develop\adaxis\aaclient\debug\aaclient.exe]
    IceDelegateD::adaxis::CAAClient::timeout(map<basic_string<char,char_traits<char>::std,allocator<char>::std>::std,basic_string<char,char_traits<char>::std,allocator<char>::std>::std,less<basic_string<char,char_traits<char>::std,allocator<char>::std>::std>::std,allocator<pair<>::BV?$basic_string::DU?$char_traits::D::std,allocator<char>::BV?$basic_string>::std,basic_string<char,char_traits<char>::std,allocator<char>::std>::std>::std const&) [e:\develop\adaxis\interfaces\caaclient.cpp:1408]
    IceProxy::adaxis::CAAClient::timeout(map<basic_string<char,char_traits<char>::std,allocator<char>::std>::std,basic_string<char,char_traits<char>::std,allocator<char>::std>::std,less<basic_string<char,char_traits<char>::std,allocator<char>::std>::std>::std,allocator<pair<>::BV?$basic_string::DU?$char_traits::D::std,allocator<char>::BV?$basic_string>::std,basic_string<char,char_traits<char>::std,allocator<char>::std>::std>::std const&) [e:\develop\adaxis\interfaces\caaclient.cpp:620]
    IceProxy::adaxis::CAAClient::timeout(void) [e:\develop\adaxis\interfaces\caaclient.cpp:607]
    CGeneralTimeoutThread::extRun(void) [e:\develop\adaxis\aaclient\cgeneraltimeoutthread.cpp:64]
    Allocation location
    malloc [f:\vs70builds\3077\vc\crtbld\crt\src\dbgheap.c:138]
    startHook [c:\builds\ice\src\iceutil\thread.cpp:203]
    threadstartex [f:\vs70builds\3077\vc\crtbld\crt\src\threadex.c:241]
    EXI: Ignored exception in Ice::ConnectionRefusedException::ice_throw(void)const {4 occurrences}
    EXH: Handled exception in Ice::ConnectionRefusedException::ice_throw(void)const {4 occurrences}
  • bernard
    bernard Jupiter, FL
    Again, user error :)

    I've just purified the operations test:
    - latest Ice, debug build
    - Visual Studio 2003
    - Windows XP SP2
    - Purify 2003.06.13.402.000 Build: 5352 (latest AFAIK)

    With a normal build, I get thousands of FMMs; however Purify tells me what to do:

    C:\builds\ice\test\Ice\operations>purify server
    Purify for Windows,
    (C) Copyright IBM Corporation. 1992, 2004. All Rights Reserved.
    Version 2003.06.03; Build: 5352;
    WinNT 5.1 2600 Service Pack 2 Uniprocessor Free
    Instrumenting:
    server.EXE 507904 bytes

    Purify: While processing file C:\builds\ice\test\Ice\operations\server.EXE:
    Warning: Code detected but missing .reloc section.
    Unable to instrument module as requested.
    Module will be instrumented in Minimal mode.
    For VC, use /FIXED:NO linker option.

    "Minimal mode" means trouble.
    I add /FIXED:NO and relink the exes, et voila, clean Purify runs :)

    Please continue to purify Ice! If you find any problem, giving us a test-case (or an existing Ice demo / test program) would be very useful.

    Cheers,
    Bernard
  • Hi Bernard,

    thanks for the hint. I switch on (resp. off) the fixed parameter and I get no fmm errors in the debug version (against one remaining in the release version).

    Can you please tell me if "fixed:no" results in a cosmetic correction (no stop purify throwing error messages) or whether it really improves the safety of the program?

    If it's the latter one, will you include this parameter in the Visual C++ settings corner in the readme?

    Stephan
  • bernard
    bernard Jupiter, FL
    Hi Stephan,

    The issue is whether Purify is able to instrument the libraries linked with your .exe or not. If it cannot, it will report bogus FMMs; if it can, it figures out that there is no mismatched memory.
    I think it's a Purify-only requirement: the exes are not safer with /FIXED:NO.

    We will look into making the default builds more Purify-friendly.

    Bernard