XCSP3-CPP-Parser icon indicating copy to clipboard operation
XCSP3-CPP-Parser copied to clipboard

Memory leak

Open rafa-hub opened this issue 5 years ago • 4 comments

Hi, I would ask you for some help. I read XCSP3 "Knight" files and I generate a matrix with the information of the variables and arrays at the very beginning. After this step, while reading the file I write on this matrix and no new data structures are created, but the program process memory grows and the Operating System shuts down the program process. So I can only work with files under Knights-050-25. I have looked at the stack with GDB, but the stack remains the same and it does not grow while executing the program. Do you have any hint or any help?

By the way, I have noticed that reading Knight files the parameters change order when the index is between 10 and 20, so at the method: buildConstraintPrimitive() with a file, lets say: x[1] x[8] x[1] x[9] x[1] x[10] x[1] x[11] x[1] x[12] The sequence of values of XVariables x and y are the following: x- 1 : x- 8 x- 1 : x- 9 x- 10 : x 1 x- 11 : x-1 x- 12: x- 1 Any reason for this? Thank you in advance, regards, Rafael

rafa-hub avatar Jun 10 '19 15:06 rafa-hub

Just to try to add my two cents: Could it be possible that at: void XCSP3Manager::unfoldConstraint(XConstraintGroup *group, int i, void (XCSP3Manager::*newConstraint)(T *)) memory is allocated but not destroyed until the file is parsed?

rafa-hub avatar Jun 12 '19 09:06 rafa-hub

I am outside my office this week. I will take a look to this issue next one.

audemard avatar Jun 12 '19 12:06 audemard

Thank you for your update, and sorry in advance if it is my fault.

rafa-hub avatar Jun 12 '19 14:06 rafa-hub

Hello For the first part, Did you test the program under valgrind ?

For the second part : By the way, I have noticed that reading Knight files the parameters change order when the index is between 10 and 20, so at the method: buildConstraintPrimitive() with a file, lets say: x[1] x[8] x[1] x[9] x[1] x[10] x[1] x[11] x[1] x[12]

I compute a canonization of the Tree and sort parameters for commutative operators. The sort is done in lexicographic order and then x[2] is greater than x[10]. By the way, this allow to reduce the size of the tree provided by the user.

audemard avatar Jun 15 '19 16:06 audemard