help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] glp_main frees environment


From: glpk xypron
Subject: Re: [Help-glpk] glp_main frees environment
Date: Sun, 06 Nov 2011 19:23:05 +0100

Hello Nigel,

you assign memory to lp, but you do not release it before calling
glpk_main.

glp_main calls glp_free_env in line 1321 of glpk-4.47/src/glpapi21.c
glp_free_env checks if all blocks are released.

It might be preferable to move glp_free_env to glpsol.c

Please, remember glp_main is not a documented API function in glpk.pdf.

Best regards

Xypron

-------- Original-Nachricht --------
> Datum: Sun, 06 Nov 2011 06:18:33 -0800
> Betreff: [Help-glpk] (no subject)

> Andrew,
> 
> Should the following code cause glpk to loose its blocks?
> 
> #include <stdio.h>
> #include <stdlib.h>
> #include "glpk.h"
> 
> 
> int main(void)
> { 
>     glp_prob *lp;
>     char *com[2];
>     
>     lp = glp_create_prob();
>     
>     com[0] = "glpsol";
>     com[1] = "--version";
>     
>     glp_main(2, (const char**)com);
>     return 0;
> }
> 
> The output is:
> 
> GLPSOL: GLPK LP/MIP Solver, v4.47
> 
> Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
> 2009, 2010, 2011 Andrew Makhorin, Department for Applied Informatics,
> Moscow Aviation Institute, Moscow, Russia. All rights reserved.
> 
> This program has ABSOLUTELY NO WARRANTY.
> 
> This program is free software; you may re-distribute it under the terms
> of the GNU General Public License version 3 or later.
> Error: 5 memory block(s) were lost
> Error detected in file
> ../../../../../msys/home/Nigel/glpk-4.47/src/glpapi21.c at line 1314
> 
> This application has requested the Runtime to terminate it in an unusual
> way.
> Please contact the application's support team for more information.
> 
> RUN FAILED (exit value 3, total time: 4s)
> 
> 
> 
> -- 
>   Nigel Galloway
>   address@hidden
> 
> -- 
> http://www.fastmail.fm - One of many happy users:
>   http://www.fastmail.fm/docs/quotes.html
> 
> 
> _______________________________________________
> Help-glpk mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-glpk

-- 
Follow me at http://twitter.com/#!/xypron

NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!               
Jetzt informieren: http://www.gmx.net/de/go/freephone



reply via email to

[Prev in Thread] Current Thread [Next in Thread]