I have been struggling with memory leaks for awhile, and finally tracked it down to the use of the built-in mathematical constants like pi, e, etc.
As a minimal example, running the code: while pi<4: x=0 will gradually exhaust all available memory. The same is true if pi is replaced by e, euler_gamma etc. (But not if pi is replaced with 3, for example.) Stopping execution does not free the memory, nor does garbage collection. The only way to recover the memory seems to be to restart the sage process. If I run print(get_memory_usage()) sage doesn't think any additional memory is being used, however the python process is rapidly consuming memory. Memory is also leaked numerically approximating constants, so while true: x=N(pi) similarly leaks memory, whereas replacing x=N(pi) by x=pi does not. I have observed this behavior in versions 8.2, 8.6 and 9.2. I found this old related bug report in the tracker: https://trac.sagemath.org/ticket/27536 and added a comment, however this issue seems to be broader than what is described there. -- 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/15fc0fd3-950e-449c-aeb0-0972c59ddfabn%40googlegroups.com.