|Subject:||Re: [Help-glpk] Gplk and exception handling|
|Date:||Thu, 20 Mar 2014 08:37:25 -0300|
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.
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?
|[Prev in Thread]||Current Thread||[Next in Thread]|