Hi!

On 2014-11-11, Peter Mueller <ypf...@googlemail.com> wrote:
>> Is it needed to install an optional package first? Which?
>>
>
> indeed, you have to install  cbc-2.8.1.p0 first (if you have sage version 
> 6.3). It takes some time to compile.

Thanks! I can confirm that there is a leak, and it seems that it
concerns six objects that are tracked by the cyclic garbage collector,
but can not be collected.

  sage: import gc
  sage: gc.collect()
  22
  sage: P = MixedIntegerLinearProgram(solver="Coin")
  sage: gc.collect()
  0
  sage: len(gc.get_objects())
  91944
  sage: P = MixedIntegerLinearProgram(solver="Coin")
  sage: len(gc.get_objects())
  91950
  sage: P = MixedIntegerLinearProgram(solver="Coin")
  sage: len(gc.get_objects())
  91956
  sage: P = MixedIntegerLinearProgram(solver="Coin")
  sage: len(gc.get_objects())
  91962
  sage: P = MixedIntegerLinearProgram(solver="Coin")
  sage: len(gc.get_objects())
  91968

Let's try to determine their type:

  sage: S = set([id(x) for x in gc.get_objects()])
  sage: D = {}
  sage: for i in range(100):
  ....:     P = MixedIntegerLinearProgram(solver="Coin")
  ....:     del P
  ....:     _ = gc.collect()
  ....:     for x in gc.get_objects():
  ....:         if id(x) not in S:
  ....:             D[type(x)] = D.get(type(x),0)+1
  ....:             
  sage: for t,c in D.iteritems():
  ....:     if c>90:
  ....:         print t,c
  ....:         
  <class '_ast.Str'> 100
  <class '_ast.Index'> 100
  <type 'dict'> 4000
  <type 'enumerate'> 100
  <type 'frame'> 208
  <type 'module'> 100
  <class '_ast.Call'> 1000
  <type 'generator'> 200
  <class '_ast.If'> 100
  <class '_ast.Compare'> 100
  <class '_ast.Delete'> 100
  <type 'weakref'> 299
  <type 'tuple'> 302
  <type 'set'> 100
  <class '_ast.keyword'> 100
  <type 'method_descriptor'> 3200
  <type 'listiterator'> 200
  <class '_ast.Subscript'> 100
  <class '_ast.BinOp'> 100
  <type 'list'> 2994
  <class '_ast.Num'> 300
  <class '_ast.Name'> 1900
  <class '_ast.For'> 200
  <class '_ast.Attribute'> 300
  <class '_ast.Assign'> 200
  <type 'builtin_function_or_method'> 202
  <class '_ast.Interactive'> 100

We see the usual suspects (weakref), but we also see astoundingly much
stuff from _ast. And we see more than six new objects per iteration.

Anyway, I think we should open a trac ticket.

Best regards,
Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to