-
Notifications
You must be signed in to change notification settings - Fork 11
memory leak in createExprtree #28
Comments
I don't see the memory leak. Is it because nobody frees The test you mention is not part of CSIP, is it? By the way, I'm again confused by the data structure. Why is the |
To see the memory leak, you have to compile scip with The leak is because of
No, the exponent of The test is part of CSIP. An ugly fix is to store which expressions got used while creating the constraint and then free all the ones that were not used. A more elegant would be to not use As for the data structure: int nops = 3;
CSIP_OP ops[] = {VARIDX, CONST, POW};
int children[] = {2, 0, 0, 1};
int begin[] = {0, 1, 2, 4};
double values[] = {2.0}; the |
If the |
The problem is that exponent = values[children[begin[children[begin[i] + 1]]]]; the code is getting the exponent directly from the values array. This, in principle, should be forbidden, and the only one who should have access to the values array is a However, when creating an expression of type So, we can change the data structure so that whenever and operation has type |
If you can access them like that (and |
Yes, it is just that we actually don't need the |
I was just running
Is this related to this issue, or maybe a problem in SCIP itself? |
- don't use separate EXPR_CONST - this would lead to memory leak - see discussion at scipopt/CSIP#28
I have stumbled on the same issue again, as I'm migrating this code to the new SCIP.jl. I would say that the bug (causing the memory leak) is not a problem in CSIP, but only in the way that CSIP is used. So, really, the data in the test case is wrong, and our MathProgBase code for transforming expressions from Julia to CSIP has the actual issue. There, we need special treatment of power expressions. |
I don't remember why we (or I) decided to use
CONST
expressions to represent exponents ofPOW
expressions.So, for instance, to represent
z^2
wherez
is the third variable of some problem, the code is like:see test.c::test_nlp
However, that
CONST
expression is never used when creating the expression tree, since when creating thePOW
expression the code looks directly intovalues
:This of course produces a memory leak, since the created
CONST
expression is never used, hence, never freedThe text was updated successfully, but these errors were encountered: