memory leak from sympy - embedded python

142 views
Skip to first unread message

Denis Akhiyarov

unread,
Jul 16, 2014, 10:32:37 AM7/16/14
to sy...@googlegroups.com
I'm calling iteratively functions from embedded python. The functions share few common sympy expressions from a closure above them on which the function do subs() and solve(). The environment variable SYMPY_USE_CACHE does not work for me. I have to manually clean the cache. Even with that I still get the memory leak which I confirmed on Python side with empty def function(*args): return 0. Investigation with guppy showed that most of the memory consists of:

[Set of 266944 <mixed> objects. Total size = 72143480 bytes.
 Index     Size   %   Cumulative  %   Brief
     0     1684   0.0      1684   0.0 sympy.core.assumptions.StdFactKB: 0x701a750
     1      532   0.0      2216   0.0 sympy.core.assumptions.StdFactKB: 0x701a620
     2      532   0.0      2748   0.0 sympy.core.assumptions.StdFactKB: 0x701a9b0
     3      532   0.0      3280   0.0 sympy.core.assumptions.StdFactKB: 0x701aa48
     4      532   0.0      3812   0.0 sympy.core.assumptions.StdFactKB: 0x701aae0
     5      532   0.0      4344   0.0 sympy.core.assumptions.StdFactKB: 0x701ad40
     6      532   0.0      4876   0.0 sympy.core.assumptions.StdFactKB: 0x7057a48
     7      532   0.0      5408   0.0 sympy.core.assumptions.StdFactKB: 0x7057ca8
     8      532   0.0      5940   0.0 sympy.core.assumptions.StdFactKB: 0x7057d40
     9      532   0.0      6472   0.0 sympy.core.assumptions.StdFactKB: 0x7057dd8


How can I clean these assumptions?

guppy==0.1.10
numpy==1.8.1
sympy==0.7.5


Python 2.7.7 (default, Jun  1 2014, 14:17:13) [MSC v.1500 32 bit (Intel)] on win32

Ondřej Čertík

unread,
Jul 16, 2014, 3:01:06 PM7/16/14
to sympy
Hi Denis,
We just merged this PR:

https://github.com/sympy/sympy/pull/7464

So now sympy's memory usage by default should not grow beyond the
limited size of the cache.

Ondrej

Denis Akhiyarov

unread,
Jul 17, 2014, 8:20:29 AM7/17/14
to sy...@googlegroups.com
Hi Ondrej,

When can I expect sympy 0.7.6 or next release?

Thanks,
Denis

Aaron Meurer

unread,
Jul 17, 2014, 5:42:37 PM7/17/14
to sy...@googlegroups.com
We don't have a release timeline. We can really do one whenever. There
are some blocking issues on the milestone
https://github.com/sympy/sympy/issues?milestone=8&state=open, although
I'm guessing that most of those can be pushed.

Aaron Meurer

On Thu, Jul 17, 2014 at 7:20 AM, Denis Akhiyarov
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/7f1a78b3-17b1-4c2c-8c1d-0ce095cc2f9a%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages