[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: Wed, 19 Mar 2014 09:52:16 -0300


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 glp_delete_prob().
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
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-18 17:37 GMT-03:00 Heinrich Schuchardt <address@hidden>:
Hello Sylvain,

if an internal error occurs in GLPK for Java it calls glp_free_env() before throwing GlpkException. This frees (and invalidates) all memory allocated by the GLPK library.

The exception will not free memory allocated by
- new_doubleArray
- new_intArray

For these you have to call the delete methods
- delete_doubleArray
- delete_intArray.

Garbage collection will neither free said arrays nor any memory assigned by the GLPK library.

Best regards

Heinrich Schuchardt

On 17.03.2014 14:50, Sylvain Fournier wrote:
Hello Heinrich,

Rabih talked about garbage collection. I'd like to know if GLPK for Java
handles garbage collection and automatically deletes the problem object
in C (either in case of exception or in a normal run) or if it must be
done by hand.
If GLPK for Java handles garbage collection, could you tell me since
which version?

*Sylvain Fournier*

reply via email to

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