I have a code like

def f(P):
    . . . something that returns a positive number.

m=0
for P in Posets(n):
    m=max(m, f(P))

Now, it seems that this eats memory. I guess that is because of UniqueRepresentation that Poset inherits. This is not a problem when n=9, it is irritating when n=10 and makes computing impossible when n=11.

Is there any easy way to free memory used by an object?

To test this try for example

n=0
for P in Posets(8):
    n += 1
    if n%1000==0:
        print sage.misc.getusage.get_memory_usage()

--
Jori Mäntysalo

Reply via email to