Package: sagemath Version: 9.0-4+b1 Severity: normal It seems the basic sagemath integer objects do not release memory properly when freed. Quick way to reproduce:
while 1: x=divisors(factorial(15)) running the above line leaks memory at around 100 MB/s order of magnitude. A bit longer demonstration that shows the memory leak is about general integer objects, not about the implementation of divisors() or factorial(): i = 0 while 1: a = [] for _ in range(1000): a.append(i) i += 1 This repeatedly creates 1000 integers at once, then frees them. If you drop the number created at once below 100, it stops leaking memory. That limit of about 100 matches the pool size in /usr/lib/python3/dist-packages/sage/rings/integer.pyx which I believe shows the relevant Sage integer implementation. Once there are enough freed integers that they do not fit in the pool, the code doing actual allocation and release of new objects leaks memory. It seems to access GMP internals, so the behavior might depend on libgmp version. -- System Information: Debian Release: bullseye/sid APT prefers unstable-debug APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 5.6.0-2-amd64 (SMP w/4 CPU threads) Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE Locale: LANG=C, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages sagemath depends on: ii cysignals-tools 1.10.2+ds-4 ii cython3 0.29.14-2 ii ecl 16.1.3+ds-4 ii eclib-tools 20190909-3 ii fflas-ffpack 2.4.3-1 ii flintqs 1:1.0-3+b1 ii gap-atlasrep 2.1.0-2 ii gap-dev 4.11.0-4 ii gap-online-help 4.11.0-4 ii gap-primgrp 3.4.0-1 ii gap-smallgrp 1.4.1-1 ii gap-table-of-marks 1.2.9-1 ii gap-transgrp 2.0.4-1 ii gfan 0.6.2-2 ii gmp-ecm 7.0.4+ds-5 ii ipython3 7.16.1-1 ii iso-codes 4.5.0-1 ii jmol 14.6.4+2016.11.05+dfsg1-4 ii lcalc 1.23+dfsg-11 ii less 551-2 ii libatlas3-base [libblas.so.3] 3.10.3-10 ii libblas3 [libblas.so.3] 3.9.0-2 ii libbraiding0 1.0-1+b1 ii libbrial-groebner3 1.2.8-1 ii libbrial3 1.2.8-1 ii libc6 2.30-8 ii libcdd-tools 094j-2 ii libcliquer1 1.21-2 ii libec5 20190909-3 ii libecm1 7.0.4+ds-5 ii libflint-2.5.2 2.5.2-23 ii libflint-arb2 1:2.18.1-1 ii libgap7 4.11.0-4 ii libgcc-s1 10.1.0-4 ii libgd3 2.3.0-2 ii libgivaro9 4.1.1-2 ii libglpk40 4.65-2 ii libgmp10 2:6.2.0+dfsg-6 ii libgmpxx4ldbl 2:6.2.0+dfsg-6 ii libgomp1 10.1.0-4 ii libgsl25 2.6+dfsg-2 ii libhomfly0 1.02r5-1+b1 ii libiml0 1.0.4-1+b2 ii libjs-mathjax 2.7.8+dfsg-1 ii libjs-three 111+dfsg1-1 ii liblfunction0 1.23+dfsg-11 ii liblrcalc1 1.2-2+b1 ii libm4ri-0.0.20200125 20200125-1+b1 ii libm4rie-0.0.20200125 20200125-1+b2 ii libmpc3 1.1.0-1 ii libmpfi0 1.5.3+ds-4 ii libmpfr6 4.0.2-1 ii libntl43 11.4.3-1+b1 ii libopenblas0-pthread [libblas.so.3] 0.3.10+ds-1 ii libpari-gmp-tls6 2.11.4-3 ii libplanarity0 3.0.0.5-5 ii libppl14 1:1.2-8.1 ii libpynac18py3 0.7.26-4+b1 ii libratpoints-2.1.3 1:2.1.3-1+b2 ii libreadline8 8.0-4 ii librw0 0.8+ds-1+b1 ii libsingular4m1 1:4.1.1-p2+ds-4+b1 ii libstdc++6 10.1.0-4 ii libsymmetrica2 2.0+ds-6 ii libzn-poly-0.9 0.9.1-2 ii maxima-sage 5.42.2-2+b1 ii maxima-sage-share 5.42.2-2 ii nauty 2.6r10+ds-1 ii palp 2.11-1 ii pari-galdata 0.20080411-2 ii pari-gp 2.11.4-3 ii pari-seadata 0.20090618-1 ii python-ppl-doc 0.8.4-4 ii python3 3.8.2-3 ii python3-alabaster 0.7.8-1.1 ii python3-babel 2.8.0+dfsg.1-3 ii python3-brial 1.2.8-1 ii python3-cvxopt 1.2.3+dfsg-2+b2 ii python3-cycler 0.10.0-3 ii python3-cypari2 2.1.1-2+b2 ii python3-cysignals-pari 1.10.2+ds-4+b1 ii python3-decorator 4.4.2-2 ii python3-docutils 0.16+dfsg-2 ii python3-fpylll 0.5.1+ds1-3 ii python3-future 0.18.2-2 ii python3-gmpy2 2.1.0~b4-1+b1 ii python3-imagesize 1.2.0-2 ii python3-ipython-genutils 0.2.0-3 ii python3-itsdangerous 1.1.0-2 ii python3-matplotlib 3.2.2-1 ii python3-mistune 0.8.4-3 ii python3-mpmath 1.1.0-2 ii python3-networkx 2.4-3 ii python3-nose 1.3.7-6 ii python3-numpy [python3-numpy-abi9] 1:1.19.0-1 ii python3-packaging 20.3-1.2 ii python3-path 12.0.1-2 ii python3-pexpect 4.6.0-3 ii python3-pickleshare 0.7.5-2 ii python3-pil 7.0.0-4+b1 ii python3-pip 20.1.1-2 ii python3-pkgconfig 1.5.1-3 ii python3-ppl 0.8.4-4+b1 ii python3-psutil 5.7.0-1 ii python3-ptyprocess 0.6.0-2 ii python3-pygments 2.3.1+dfsg-3 ii python3-rpy2 [python3-rpy2] 3.3.5-1 ii python3-scipy 1.4.1-2 ii python3-setuptools 46.1.3-1 ii python3-setuptools-scm 3.4.3+really3.3.3-5 ii python3-simplegeneric 0.8.1-3 ii python3-singledispatch 3.4.0.3-3 ii python3-snowballstemmer 2.0.0-1 ii python3-sphinx 2.4.3-4 ii python3-stemmer 1.3.0+dfsg-3+b1 ii python3-sympy 1.6-4 ii python3-terminado 0.8.2-3 ii python3-tornado 6.0.4-2 ii python3-traitlets 4.3.3-3 ii python3-tz 2020.1-2 ii python3-vcversioner 2.16.0.0-2 ii python3-wcwidth 0.1.9+dfsg1-2 ii python3-werkzeug 0.16.1+dfsg1-2 ii python3-zmq 18.1.1-4 ii python3-zope.interface 4.7.1-2 ii r-base-core 4.0.2-1 ii rubiks 20070912-5 ii sagemath-common 9.0-4 ii sagemath-database-conway-polynomials 0.5-7 ii sagemath-database-elliptic-curves 0.8.1-4 ii sagemath-database-graphs 20161026+dfsg-4 ii sagemath-database-mutually-combinatorial-designs 20140630-5 ii sagemath-database-polytopes 20170220-4 ii singular 1:4.1.1-p2+ds-4+b1 ii sqlite3 3.32.3-1 ii sympow 2.023.6-1 ii tachyon 0.99~b6+dsx-9 ii xcas 1.5.0.87+dfsg1-7 Versions of packages sagemath recommends: ii maxima-sage-doc 5.42.2-2 ii pari-doc 2.11.4-3 ii python3-sagenb-export 3.2-4 ii r-cran-lattice 0.20-41-1+b1 ii sagemath-doc 9.0-4 ii sagemath-jupyter 9.0-4 ii sagetex 3.4+ds-2 ii singular-doc 1:4.1.1-p2+ds-4 ii texlive-latex-base 2020.20200629-1 Versions of packages sagemath suggests: pn dot2tex <none> pn gap-design <none> ii gap-factint 1.6.3+ds-1 pn gap-grape <none> pn gap-guava <none> pn gap-laguna <none> pn gap-sonata <none> pn gap-toric <none> -- no debconf information