Hi All, tldr: the bottom of this post contains example code of which I would like the results on some other systems.
I recently encountered a memory leak in the relatively innocently looking code: d = 27 M = 109 for i in range(10000): for a in srange(M): for r in srange(d): tmp = r*a However it doesn't seem to be on all platforms that sage supports. For example on cocalc (ubuntu 20.04) one gets: ~$ sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.2, Release Date: 2020-10-24 │ │ Create a "Sage Worksheet" file for the notebook interface. │ │ Enhanced for CoCalc. │ │ Using Python 3.8.5. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: import gc ....: gc.collect() ....: mem = get_memory_usage() ....: d = 27 ....: M = 109 ....: for i in range(10000): ....: for a in srange(M): ....: for r in srange(1,d): ....: tmp = r*a ....: gc.collect() ....: print("memory usage 10k:", get_memory_usage(mem)) ....: mem = get_memory_usage() ....: for i in range(20000): ....: for a in srange(M): ....: for r in srange(1,d): ....: tmp = r*a ....: gc.collect() ....: print("memory usage 20k:", get_memory_usage(mem)) ....: 434 0 memory usage 10k: 9.15234375 0 memory usage 20k: 21.3984375 showing clear indication of a memory leak. While on my own laptop (OS X 10.13.6) I get: ~ mderickx$ sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.2, Release Date: 2020-10-24 │ │ Using Python 3.8.5. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: import gc ....: gc.collect() ....: mem = get_memory_usage() ....: d = 27 ....: M = 109 ....: for i in range(10000): ....: for a in srange(M): ....: for r in srange(1,d): ....: tmp = r*a ....: gc.collect() ....: print("memory usage 10k:", get_memory_usage(mem)) ....: mem = get_memory_usage() ....: for i in range(20000): ....: for a in srange(M): ....: for r in srange(1,d): ....: tmp = r*a ....: gc.collect() ....: print("memory usage 20k:", get_memory_usage(mem)) ....: 278 0 memory usage 10k: 0.0 0 memory usage 20k: 0.0 so here the memory leak does not occur. However I don't have any other systems to which I have access to. So I was wondering if people could execute the code below on some other systems and report back here to see where the leaking is actually occurring. Since I do not have access to a plain vanilla sage install on ubuntu, *I am especially interested if on ubuntu the non cocalc enhanced version of sage also produces a memory leak for the following code:* import gc gc.collect() mem = get_memory_usage() d = 27 M = 109 for i in range(10000): for a in srange(M): for r in srange(1,d): tmp = r*a gc.collect() print("memory usage 10k:", get_memory_usage(mem)) mem = get_memory_usage() for i in range(20000): for a in srange(M): for r in srange(1,d): tmp = r*a gc.collect() print("memory usage 20k:", get_memory_usage(mem)) -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/5882460b-842c-49c4-b33b-fae1c7986db9n%40googlegroups.com.