#15284: Memory leak in the interface with Gurobi
-------------------------------------+-------------------------------------
       Reporter:  ncohen             |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-5.13
      Component:  linear             |   Resolution:
  programming                        |    Merged in:
       Keywords:                     |    Reviewers:
        Authors:  Nathann Cohen      |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:  u/ncohen/15284     |  aa21671afc00003ed70095448146476eb036c143
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by ncohen):

 Ahahaha. Don't really know. Just used to checking that before freeing
 memory `:-)`

 This being said, I just checled the doc and it explicitly says that `env`
 should only be freed after the model has been freed :
 http://www.gurobi.com/documentation/5.6/reference-manual/c_grbfreeenv

 Also, there was some "weird" memory leak, which this patch now fixes : in
 order to define a model you need to define a "master environment", and the
 model creates a copy of the "master environment", and that copy is the one
 you should work on. However, if you delete the master environment segfault
 follows.

 So. This patch creates a "master environment" variable to STORE the
 temporary environment that was never deallocated. Everything then is done
 on the real environment, and when everything is done both environment are
 deallocated. Without checks for NULL, as it has been checked before, when
 the environment were created.

 Weird behaviour, but branch updated ! `;-)`

 Nathann

 P.S. : Oh, and I also replace `** model` by `* model`. Makes the code
 simpler `:-P`

--
Ticket URL: <http://trac.sagemath.org/ticket/15284#comment:3>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to