On Sun, 25 Nov 2018, 'Martin R' via sage-devel wrote:

I still think that there is something odd going on.  I do not understand the 
following:
def check(n):
    while True:
        for P in Posets(n):
            Q = P.with_bounds()
            x = Q.moebius_function(Q.bottom(), Q.top())
        print get_memory_usage()

The code can be made a little shorter:

def check(n):
    while True:
        for P in Posets(n):
            x = P._hasse_diagram.moebius_function(0, n-1)
        print get_memory_usage()

It still has the same error limit, i.e. check(6) works but check(7) does not. I played a little with the code, and gc.collect() does not seem to make anything. After a little more I got

AttributeError: 'FinitePoset_with_category' object has no attribute 
'_hasse_diagram'

from the code!

I reset the notebook and tried

def check(n):
    while True:
        i = 0
        for P in Posets(n):
            x = P._hasse_diagram.moebius_function(0, n-1)
            i += 1
            if i > 2000:
                break
        print get_memory_usage()

and still get memory leak. But with i > 1000 it works. So it's not about size of poset but the number of them.

Weird.

--
Jori Mäntysalo

Reply via email to