This also appears to leak memory: def get_polytope(): q = MixedIntegerLinearProgram( maximization = False, solver = 'Coin' ) w = q.new_variable(real = True, nonnegative = True) q.add_constraint( w[0] == 0 )
def fill_memory(n): for i in xrange(n): P = get_polytope() best, saul On Wednesday, November 2, 2016 at 2:34:44 AM UTC-7, Saul Schleimer wrote: > Here is a bit of code: > > # foo.py > > def dot_prod(v, w): > return sum(x*y for (x, y) in zip(v, w)) > > def get_polytope(M): > q = MixedIntegerLinearProgram( maximization = False, solver = 'Coin' ) > w = q.new_variable(real = True, nonnegative = True) > for v in M.rows(): > q.add_constraint( dot_prod(v, w) == 0 ) > return q.polyhedron() > > M = Matrix([[1,0],[0,1]]) > > def fill_memory(n): > for i in xrange(n): > P = get_polytope(M) > > Now I can do the following: > > [Code]$ sage > ┌────────────────────────────────────────────────────────────────────┐ > │ SageMath Version 6.8, Release Date: 2015-07-26 │ > │ Type "notebook()" for the browser-based notebook interface. │ > │ Type "help()" for help. │ > └────────────────────────────────────────────────────────────────────┘ > sage: attach('foo.py') > sage: get_memory_usage() > 288.58984375 > sage: fill_memory(2000); get_memory_usage() > 300.5859375 > sage: fill_memory(2000); get_memory_usage() > 302.5859375 > sage: fill_memory(2000); get_memory_usage() > 303.5859375 > sage: fill_memory(2000); get_memory_usage() > 305.5859375 > > It seems like MixedIntegerLinearProgram is leaking memory. This kills my > computer during long computations. > > Suggestions? > > all the best, > > saul > > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.