I can make my observation now a bit more precise, and I am sure that there 
is a memory problem.

I used

sage -pip install memory_profiler

Let memory.py be the following file:
###################################################
from memory_profiler import profile
@profile
def check_good(n):
    for P in Posets(n):
        Q = P.with_bounds()
    print get_memory_usage()

@profile
def check_bad(n):
    for P in Posets(n):
        Q = P.with_bounds()
        x = Q.moebius_function(Q.bottom(), Q.top())
    print get_memory_usage()
##########################################################

The session below shows that no additional memory is allocated by 
check_good and, for n<7 by check_bad(n).  However, check_bad(7) allocates 
additional memory on every run.  Eventually, my computer runs out of memory 
and the process is killed :-(

Help is very much appreciated!

Martin

┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.5.beta4, Release Date: 2018-11-18               │
│ Using Python 2.7.15. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: load('/home/martin/memory.py')
sage: %load_ext memory_profiler
sage: check_bad(3)
6216.8828125
Filename: /home/martin/memory.py

Line #    Mem usage    Increment   Line Contents
================================================
    21    210.5 MiB    210.5 MiB   @profile
    22                             def check_bad(n):
    23    227.0 MiB      2.9 MiB       for P in Posets(n):
    24    227.0 MiB     13.5 MiB           Q = P.with_bounds()
    25    227.0 MiB      0.0 MiB           x = 
Q.moebius_function(Q.bottom(), Q.top())
    26    227.0 MiB      0.0 MiB       print get_memory_usage()


sage: check_bad(3)
6217.1328125
Filename: /home/martin/memory.py

Line #    Mem usage    Increment   Line Contents
================================================
    21    227.2 MiB    227.2 MiB   @profile
    22                             def check_bad(n):
    23    227.2 MiB      0.0 MiB       for P in Posets(n):
    24    227.2 MiB      0.0 MiB           Q = P.with_bounds()
    25    227.2 MiB      0.0 MiB           x = 
Q.moebius_function(Q.bottom(), Q.top())
    26    227.2 MiB      0.0 MiB       print get_memory_usage()


sage: check_good(7)
6247.0390625
Filename: /home/martin/memory.py

Line #    Mem usage    Increment   Line Contents
================================================
    15    227.2 MiB    227.2 MiB   @profile
    16                             def check_good(n):
    17    256.9 MiB     18.8 MiB       for P in Posets(n):
    18    256.9 MiB     10.9 MiB           Q = P.with_bounds()
    19    256.9 MiB      0.0 MiB       print get_memory_usage()


sage: check_good(7)
6247.296875
Filename: /home/martin/memory.py

Line #    Mem usage    Increment   Line Contents
================================================
    15    256.9 MiB    256.9 MiB   @profile
    16                             def check_good(n):
    17    257.2 MiB      0.3 MiB       for P in Posets(n):
    18    257.2 MiB      0.0 MiB           Q = P.with_bounds()
    19    257.2 MiB      0.0 MiB       print get_memory_usage()


sage: check_bad(7)
6250.765625
Filename: /home/martin/memory.py

Line #    Mem usage    Increment   Line Contents
================================================
    21    257.4 MiB    257.4 MiB   @profile
    22                             def check_bad(n):
    23    260.5 MiB      2.6 MiB       for P in Posets(n):
    24    260.5 MiB      0.5 MiB           Q = P.with_bounds()
    25    260.5 MiB      0.0 MiB           x = 
Q.moebius_function(Q.bottom(), Q.top())
    26    260.5 MiB      0.0 MiB       print get_memory_usage()


sage: check_bad(7)
6255.66796875
Filename: /home/martin/memory.py

Line #    Mem usage    Increment   Line Contents
================================================
    21    260.5 MiB    260.5 MiB   @profile
    22                             def check_bad(n):
    23    265.4 MiB      3.4 MiB       for P in Posets(n):
    24    265.4 MiB      1.5 MiB           Q = P.with_bounds()
    25    265.4 MiB      0.0 MiB           x = 
Q.moebius_function(Q.bottom(), Q.top())
    26    265.4 MiB      0.0 MiB       print get_memory_usage()


sage: check_bad(7)
6258.890625
Filename: /home/martin/memory.py

Line #    Mem usage    Increment   Line Contents
================================================
    21    265.4 MiB    265.4 MiB   @profile
    22                             def check_bad(n):
    23    268.8 MiB      2.8 MiB       for P in Posets(n):
    24    268.8 MiB      0.5 MiB           Q = P.with_bounds()
    25    268.8 MiB      0.0 MiB           x = 
Q.moebius_function(Q.bottom(), Q.top())
    26    268.8 MiB      0.0 MiB       print get_memory_usage()

-- 
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.

Reply via email to