[Top][All Lists]

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

Re: [Help-glpk] Gplk and exception handling

From: Sylvain Fournier
Subject: Re: [Help-glpk] Gplk and exception handling
Date: Thu, 20 Mar 2014 08:37:25 -0300

Hello Heinrich,

Thanks for the explanations.
Best regards,

Sylvain Fournier
Analista de Pesquisa Operacional
48 3239-2423
WPLEX Software Ltda.
Rod SC 401 no. 8600 Corporate Park bloco 5 sala 101
88050-000 Santo Antônio de Lisboa, Florianópolis SC +55 48 3239-2400

2014-03-19 18:08 GMT-03:00 Heinrich Schuchardt <address@hidden>:
Hello Sylvain,

this is the comment in src/env/env.c:

*  int glp_free_env(void);
*  The routine glp_free_env frees all resources used by GLPK routines
*  (memory blocks, etc.) which are currently still in use.
*  Normally the application program does not need to call this routine,
*  because GLPK routines always free all unused resources. However, if
*  the application program even has deleted all problem objects, there
*  will be several memory blocks still allocated for the library needs.
*  For some reasons the application program may want GLPK to free this
*  memory, in which case it should call glp_free_env.
*  Note that a call to glp_free_env invalidates all problem objects as
*  if no GLPK routine were called.

On of the aforementioned memory blocks is the environment structure itself which is allocated in glp_init_env.

When a program completely ends all assigned memory is freed by the operating system.

Best regards

Heinrich Schuchardt

On 19.03.2014 13:52, Sylvain Fournier wrote:

Thanks Heinrich, your comment helped me get rid of a memory leak I had
in my application: although it is done correctly in the examples
provided with GLPK for Java, I had forgotten to free the array memory
using the delete methods. I was only freeing the problem memory using
Now is it necessary to call glp_free_env() at the end of the program, or
does GLPK take care of it itself in the case it exits without any error?
You say that GC doesn't free the memory assigned in the GLPK library but
in the examples, I only saw the call to this method in one case using
several threads (GmplSwing). Why is it necessary in this case and not in
the other examples?

*Sylvain Fournier*

reply via email to

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