Hi Paul,<div><br></div><div>Are you explicitly deleting smart pointers in your code??</div><div>You&#39;re not supposed to do that, the SmartPointer implementation does it for you. </div><div>Maybe that is where the error is.</div>

<div><br></div><div>Best,</div><div> Rodrigo<br><br><div class="gmail_quote">On Thu, Mar 3, 2011 at 12:48 PM, Paul Smith <span dir="ltr">&lt;<a href="mailto:phhs80@gmail.com">phhs80@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

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

<strong><span><font color="#000000"><span style="background-color:rgb(255, 255, 255)">Rodrigo</span></font></span><font color="#000000"><span style="background-color:rgb(255, 255, 255)"> López-</span></font><span><font color="#000000"><span style="background-color:rgb(255, 255, 255)">Negrete</span></font></span><font color="#000000"><span style="background-color:rgb(255, 255, 255)"> de la Fuente</span></font></strong><font color="#000000"><span style="background-color:rgb(255, 255, 255)"><br>

</span></font>Doctoral Candidate <br>Email: <a href="mailto:rln@cmu.edu" style="color:rgb(7, 77, 143)" target="_blank"><span>rln@cmu.edu</span></a><div><span style="color:rgb(34, 34, 34)"><span style="background-color:rgb(255, 255, 255)">WWW</span></span><span style="background-color:rgb(255, 255, 255)">: <a href="http://rodrigo.lopez-negrete.org" target="_blank">http://rodrigo.lopez-negrete.org</a></span><span style="background-color:rgb(255, 255, 255)"><br>

</span><br>Department of Chemical Engineering<br>Carnegie Mellon University <br>5000 Forbes Ave. <br>Pittsburgh, PA 15213-3890<br>USA</div></span><br>
</div>