[Ipopt] Memory error after get_bounds_info() in IPOPT

Stefan Vigerske stefan at math.hu-berlin.de
Sat Dec 15 08:56:25 EST 2012


the only special thing in Ipopt is the use of smart pointers,

One imporant rule is to never call delete for a smart pointer object.
Usually, you do not have to allocate or free memory in your 
implementation of get_bounds_info().

Maybe you just wrote over array boundaries somewhere.
Try running with an empty get_bounds_info() (just return true). If that 
does not crash, put back a piece of code, then another one.

valgrind can also be a very helpful tool to debug this type of issues. 
Often, it can point directly to the line where awkward things are happening.


On 12/15/2012 12:49 PM, Alex Tătulea 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

More information about the Ipopt mailing list