[Ipopt] Error while freeing SmartPointer

Paul Smith phhs80 at gmail.com
Thu Mar 3 12:48:42 EST 2011


Thanks, Hans. The crash is in file IpSmartPtr.hpp:

-------------------------------------------------
#ifdef IP_DEBUG_SMARTPTR
    DBG_START_METH(
      "void SmartPtr<T>::ReleasePointer()",
      dbg_smartptr_verbosity);
#endif

    if (ptr_) {
      ptr_->ReleaseRef(this);
      if (ptr_->ReferenceCount() == 0) {
        delete ptr_;  <------------------------------------ HERE !
      }
      ptr_ = NULL;
    }
-------------------------------------------------

Paul


On Thu, Mar 3, 2011 at 5:41 PM, Hans Pirnay <hans.pirnay at rwth-aachen.de> wrote:
> Hi Paul,
> if you are on Linux, run your program with valgrind to find out where
> exactly this happens.
> If the information you get isn't specific enough, recompile your code and
> that of ipopt in debug mode. For Ipopt, run configure with the
> --enable-debug
> option. Compile your own code with the -g flag.
> Valgrind will tell you in which file and line things go wrong
> Hans
> On Thu, Mar 3, 2011 at 6:17 PM, Paul Smith <phhs80 at gmail.com> wrote:
>>
>> Dear All,
>>
>> I am compiling an example in C++, which is correctly solved by Ipopt,
>> but when the program exits (I guess while freeing the SmartPointer),
>> it gives the error below.
>>
>> Any ideas?
>>
>> Thanks in advance,
>>
>> Paul
>>
>> -------------------------------------------------
>>
>> *** glibc detected *** /home/psmith/research/programs/myprogram/teste:
>> free(): invalid next size (normal): 0x0000000001f35770 ***
>> ======= Backtrace: =========
>> /lib64/libc.so.6[0x361ee76d63]
>>
>> /home/psmith/research/programs/myprogram/teste(_ZN5Ipopt11TNLPAdapterD1Ev+0x42)[0x46a1c2]
>>
>> /home/psmith/research/programs/myprogram/teste(_ZN5Ipopt11TNLPAdapterD0Ev+0x9)[0x46aac9]
>>
>> /home/psmith/research/programs/myprogram/teste(_ZN5Ipopt15GradientScalingD0Ev+0x166)[0x4affe6]
>>
>> /home/psmith/research/programs/myprogram/teste(_ZN5Ipopt8SmartPtrINS_16NLPScalingObjectEE15ReleasePointer_Ev+0x1f)[0x49a51f]
>>
>> /home/psmith/research/programs/myprogram/teste(_ZN5Ipopt12OrigIpoptNLPD1Ev+0x789)[0x4f69c9]
>>
>> /home/psmith/research/programs/myprogram/teste(_ZN5Ipopt12OrigIpoptNLPD0Ev+0x9)[0x4f6df9]
>>
>> /home/psmith/research/programs/myprogram/teste(_ZN5Ipopt14IpoptAlgorithmD1Ev+0x1e6)[0x522d56]
>>
>> /home/psmith/research/programs/myprogram/teste(_ZN5Ipopt14IpoptAlgorithmD0Ev+0x9)[0x522f09]
>>
>> /home/psmith/research/programs/myprogram/teste(_ZN5Ipopt16IpoptApplicationD1Ev+0x186)[0x45a0a6]
>>
>> /home/psmith/research/programs/myprogram/teste(_ZN5Ipopt16IpoptApplicationD0Ev+0x9)[0x45a1b9]
>>
>> /home/psmith/research/programs/myprogram/teste(_ZN5Ipopt8SmartPtrINS_16IpoptApplicationEE15ReleasePointer_Ev+0x6f)[0x4577d7]
>> /home/psmith/research/programs/myprogram/teste[0x456da4]
>> /home/psmith/research/programs/myprogram/teste[0x45603d]
>> /lib64/libc.so.6(__libc_start_main+0xfd)[0x361ee1ee5d]
>> /home/psmith/research/programs/myprogram/teste[0x4510e9]
>> ======= Memory map: ========
>> 00400000-007c1000 r-xp 00000000 fd:00 20447398
>>  /home/psmith/research/programs/myprogram/teste
>> 009c1000-009c8000 rw-p 003c1000 fd:00 20447398
>>  /home/psmith/research/programs/myprogram/teste
>> 009c8000-009cb000 rw-p 00000000 00:00 0
>> 01efd000-02d65000 rw-p 00000000 00:00 0
>>  [heap]
>> 361ea00000-361ea1f000 r-xp 00000000 fd:00 131168
>>  /lib64/ld-2.13.so
>> 361ec1e000-361ec1f000 r--p 0001e000 fd:00 131168
>>  /lib64/ld-2.13.so
>> 361ec1f000-361ec20000 rw-p 0001f000 fd:00 131168
>>  /lib64/ld-2.13.so
>> 361ec20000-361ec21000 rw-p 00000000 00:00 0
>> 361ee00000-361ef91000 r-xp 00000000 fd:00 131211
>>  /lib64/libc-2.13.so
>> 361ef91000-361f191000 ---p 00191000 fd:00 131211
>>  /lib64/libc-2.13.so
>> 361f191000-361f195000 r--p 00191000 fd:00 131211
>>  /lib64/libc-2.13.so
>> 361f195000-361f196000 rw-p 00195000 fd:00 131211
>>  /lib64/libc-2.13.so
>> 361f196000-361f19c000 rw-p 00000000 00:00 0
>> 361f200000-361f284000 r-xp 00000000 fd:00 131433
>>  /lib64/libm-2.13.so
>> 361f284000-361f483000 ---p 00084000 fd:00 131433
>>  /lib64/libm-2.13.so
>> 361f483000-361f484000 r--p 00083000 fd:00 131433
>>  /lib64/libm-2.13.so
>> 361f484000-361f485000 rw-p 00084000 fd:00 131433
>>  /lib64/libm-2.13.so
>> 361f600000-361f602000 r-xp 00000000 fd:00 132219
>>  /lib64/libdl-2.13.so
>> 361f602000-361f802000 ---p 00002000 fd:00 132219
>>  /lib64/libdl-2.13.so
>> 361f802000-361f803000 r--p 00002000 fd:00 132219
>>  /lib64/libdl-2.13.so
>> 361f803000-361f804000 rw-p 00003000 fd:00 132219
>>  /lib64/libdl-2.13.so
>> 361fa00000-361fa17000 r-xp 00000000 fd:00 132114
>>  /lib64/libpthread-2.13.so
>> 361fa17000-361fc16000 ---p 00017000 fd:00 132114
>>  /lib64/libpthread-2.13.so
>> 361fc16000-361fc17000 r--p 00016000 fd:00 132114
>>  /lib64/libpthread-2.13.so
>> 361fc17000-361fc18000 rw-p 00017000 fd:00 132114
>>  /lib64/libpthread-2.13.so
>> 361fc18000-361fc1c000 rw-p 00000000 00:00 0
>> 361fe00000-361fe15000 r-xp 00000000 fd:00 131871
>>  /lib64/libgcc_s-4.5.1-20100924.so.1
>> 361fe15000-3620014000 ---p 00015000 fd:00 131871
>>  /lib64/libgcc_s-4.5.1-20100924.so.1
>> 3620014000-3620015000 rw-p 00014000 fd:00 131871
>>  /lib64/libgcc_s-4.5.1-20100924.so.1
>> 3620600000-3620607000 r-xp 00000000 fd:00 133544
>>  /lib64/librt-2.13.so
>> 3620607000-3620806000 ---p 00007000 fd:00 133544
>>  /lib64/librt-2.13.so
>> 3620806000-3620807000 r--p 00006000 fd:00 133544
>>  /lib64/librt-2.13.so
>> 3620807000-3620808000 rw-p 00007000 fd:00 133544
>>  /lib64/librt-2.13.so
>> 3623a00000-3623ae8000 r-xp 00000000 fd:00 273173
>>  /usr/lib64/libstdc++.so.6.0.14
>> 3623ae8000-3623ce8000 ---p 000e8000 fd:00 273173
>>  /usr/lib64/libstdc++.so.6.0.14
>> 3623ce8000-3623cf0000 r--p 000e8000 fd:00 273173
>>  /usr/lib64/libstdc++.so.6.0.14
>> 3623cf0000-3623cf2000 rw-p 000f0000 fd:00 273173
>>  /usr/lib64/libstdc++.so.6.0.14
>> 3623cf2000-3623d07000 rw-p 00000000 00:00 0
>> 3630e00000-3630ee2000 r-xp 00000000 fd:00 281053
>>  /usr/lib64/libgfortran.so.3.0.0
>> 3630ee2000-36310e2000 ---p 000e2000 fd:00 281053
>>  /usr/lib64/libgfortran.so.3.0.0
>> 36310e2000-36310e4000 rw-p 000e2000 fd:00 281053
>>  /usr/lib64/libgfortran.so.3.0.0
>> 36310e4000-36310e5000 rw-p 00000000 00:00 0
>> 3633e00000-3633e0d000 r-xp 00000000 fd:00 275116
>>  /usr/lib64/libgomp.so.1.0.0
>> 3633e0d000-363400c000 ---p 0000d000 fd:00 275116
>>  /usr/lib64/libgomp.so.1.0.0
>> 363400c000-363400d000 rw-p 0000c000 fd:00 275116
>>  /usr/lib64/libgomp.so.1.0.0
>> 7fe43faff000-7fe43fb07000 rw-p 00000000 00:00 0
>> 7fe43fb07000-7fe43fc8d000 r-xp 00000000 fd:00 25428000
>>  /home/psmith/ipopt/lib/coin/ThirdParty/libcoinmumps.so.1.3.3
>> 7fe43fc8d000-7fe43fe8c000 ---p 00186000 fd:00 25428000
>>  /home/psmith/ipopt/lib/coin/ThirdParty/libcoinmumps.so.1.3.3
>> 7fe43fe8c000-7fe43fe8f000 rw-p 00185000 fd:00 25428000
>>  /home/psmith/ipopt/lib/coin/ThirdParty/libcoinmumps.so.1.3.3
>> 7fe43fe8f000-7fe43fe92000 rw-p 00000000 00:00 0
>> 7fe43fe92000-7fe43feda000 r-xp 00000000 fd:00 25427996
>>  /home/psmith/ipopt/lib/coin/ThirdParty/libcoinmetis.so.1.1.3
>> 7fe43feda000-7fe4400da000 ---p 00048000 fd:00 25427996
>>  /home/psmith/ipopt/lib/coin/ThirdParty/libcoinmetis.so.1.1.3
>> 7fe4400da000-7fe4400db000 rw-p 00048000 fd:00 25427996
>>  /home/psmith/ipopt/lib/coin/ThirdParty/libcoinmetis.so.1.1.3
>> 7fe4400db000-7fe440112000 r-xp 00000000 fd:00 25427994
>>  /home/psmith/ipopt/lib/coin/ThirdParty/libcoinlapack.so.1.2.3
>> 7fe440112000-7fe440312000 ---p 00037000 fd:00 25427994
>>  /home/psmith/ipopt/lib/coin/ThirdParty/libcoinlapack.so.1.2.3
>> 7fe440312000-7fe440313000 rw-p 00037000 fd:00 25427994
>>  /home/psmith/ipopt/lib/coin/ThirdParty/libcoinlapack.so.1.2.3
>> 7fe440313000-7fe440324000 rw-p 00000000 00:00 0
>> 7fe440324000-7fe440325000 r-xp 00000000 fd:00 25427998
>>  /home/psmith/ipopt/lib/coin/ThirdParty/libcoinhsl.so.1.2.3
>> 7fe440325000-7fe440524000 ---p 00001000 fd:00 25427998
>>  /home/psmith/ipopt/lib/coin/ThirdParty/libcoinhsl.so.1.2.3
>> 7fe440524000-7fe440525000 rw-p 00000000 fd:00 25427998
>>  /home/psmith/ipopt/lib/coin/ThirdParty/libcoinhsl.so.1.2.3
>> 7fe440525000-7fe44053a000 r-xp 00000000 fd:00 25428010
>>  /home/psmith/ipopt/lib/coin/ThirdParty/libcoinblas.so.1.1.3
>> 7fe44053a000-7fe44073a000 ---p 00015000 fd:00 25428010
>>  /home/psmith/ipopt/lib/coin/ThirdParty/libcoinblas.so.1.1.3
>> 7fe44073a000-7fe44073b000 rw-p 00015000 fd:00 25428010
>>  /home/psmith/ipopt/lib/coin/ThirdParty/libcoinblas.so.1.1.3
>> 7fe44073b000-7fe440986000 r-xp 00000000 fd:00 25428002
>>  /home/psmith/ipopt/lib/coin/libipopt.so.1.7.2
>> 7fe440986000-7fe440b86000 ---p 0024b000 fd:00 25428002
>>  /home/psmith/ipopt/lib/coin/libipopt.so.1.7.2
>> 7fe440b86000-7fe440b90000 rw-p 0024b000 fd:00 25428002
>>  /home/psmith/ipopt/lib/coin/libipopt.so.1.7.2
>> 7fe440b90000-7fe440b91000 rw-p 00000000 00:00 0
>> 7fe440bb7000-7fe440bb9000 rw-p 00000000 00:00 0
>> 7fffb917d000-7fffb919e000 rw-p 00000000 00:00 0
>>  [stack]
>> 7fffb91ff000-7fffb9200000 r-xp 00000000 00:00 0
>>  [vdso]
>> ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
>>  [vsyscall]
>> The program has unexpectedly finished.
>>
>> _______________________________________________
>> Ipopt mailing list
>> Ipopt at list.coin-or.org
>> http://list.coin-or.org/mailman/listinfo/ipopt
>
>




More information about the Ipopt mailing list