[Ipopt] Memory error after get_bounds_info() in IPOPT

Alex Tătulea tatulea.alex at gmail.com
Mon Dec 17 08:41:24 EST 2012

Thank you for the suggestions. I actually managed to solve the problem
without using Valgrind.
In the debugger I noticed that I was writing beyond the array boundaries in
x_l, x_u and g_l,g_u. Apparently this only became a problem after exiting
the get_bounds_info() function, when control was passed back to IPOPT.

However, now the problem is solved and all the vectors have the correct
sizes and number of elements. And the optimization runs succesfully.

Best regards,
Alexandru Tatulea

On Sat, Dec 15, 2012 at 3:00 PM, Hans Pirnay <hans.pirnay at rwth-aachen.de>wrote:

> Hi Alex,
> try compiling your code in debug mode (gcc -g) and run it through
> valgrind. valgrind will tell you where the 'free' comes from.
> Hans
> On Sat, Dec 15, 2012 at 12:49 PM, Alex Tătulea <tatulea.alex at gmail.com>
> wrote:
> > Hello,
> >
> > I am new to IPOPT and I have to code this NLP in C++ under Linux. I have
> > implemented all the functions and individually tested them, they seem to
> > return the correct results.
> >
> > But when I try running the optimizeNLP() function, I get an error in the
> > console with the message 'Double free or corruption (!prev)'. After
> tracking
> > the error with GDB, it seems that the optimizer calls the get_nlp_info()
> > routine with no error, and then performs the get_bounds_info() until
> return.
> > At this point, seems that the free() function is called (I don't know
> where
> > from) and then the memory error occurs and the program is aborted.
> >
> > If anyone has encountered something like this, please give me a hint on
> how
> > to approach this problem. Is there some particular mechanism inside IPOPT
> > for freeing memory and handling vectors I should be aware of? Inside this
> > function I am not doing much, just assigning the values to x_l, x_u and
> > g_l,g_u...
> >
> > Thanks in advance, I hope someone could help me here with an idea!
> >
> > Alex
> >
> > _______________________________________________
> > Ipopt mailing list
> > Ipopt at list.coin-or.org
> > http://list.coin-or.org/mailman/listinfo/ipopt
> >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/ipopt/attachments/20121217/39d374db/attachment.html>

More information about the Ipopt mailing list