#17320: Memory leaks with LP Solvers are back
--------------------------------------+------------------------
Reporter: pmueller | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-6.4
Component: linear programming | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
--------------------------------------+------------------------
Comment (by nbruin):
When I try to replicate Simon's memory object analysis, I do not find a
significant leak:
{{{
sage: import gc
sage: from collections import Counter
sage: gc.collect()
0
sage: gc.set_debug(gc.DEBUG_STATS)
sage: pre={id(a) for a in gc.get_objects()}
sage: for i in [1..100000]:
....: P = MixedIntegerLinearProgram(solver="Coin")
....: del P
....:
sage: gc.collect()
gc: collecting generation 2...
gc: objects in each generation: 117 0 89955
gc: done, 0.0464s elapsed.
0
sage: gc.collect()
gc: collecting generation 2...
gc: objects in each generation: 48 0 90013
gc: done, 0.0397s elapsed.
0
sage: post=Counter(str(type(a)) for a in gc.get_objects() if id(a) not in
pre)
sage: post
Counter({"<type 'method_descriptor'>": 32, "<type 'list'>": 23, "<type
'dict'>": 13, "<type 'tuple'>": 9, "<class '_ast.Name'>": 7, "<type
'weakref'>": 5, "<class '_ast.Call'>": 4, "<type 'frame'>": 2, "<type
'builtin_function_or_method'>": 2, "<type 'listiterator'>": 1, "<type
'set'>": 1, "<type 'instancemethod'>": 1, "<class '_ast.comprehension'>":
1, "<class '_ast.Compare'>": 1, "<class '_ast.Attribute'>": 1, "<class
'_ast.Interactive'>": 1, "<type 'module'>": 1})
}}}
As you can see, the garbage collector does not get triggered during the
loop (indicating that reference counting is sufficient to keep the number
of python objects bounded in memory during the loop). Also, after the loop
there are no alarming objects in "post".
I can confirm that memory usage explodes, but I think this indicates the
memory leak is outside of python managed memory.
[The problem with Simon's code might be that he doesn't update the set `S`
when he counts a new object, so there's a possibility for objects that get
created on the first pass to get counted every time.]
--
Ticket URL: <http://trac.sagemath.org/ticket/17320#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/d/optout.