The following code ends up using a lot of memory: print get_memory_usage() for i in range(100000): b=binomial(5,2) print get_memory_usage()
Output: 133.48828125 135.015625 So 1.5 extra megabytes is used after the 100,000 calls of binomial. If repeated calls to binomial are made, eventually Sage runs out of memory and bombs out. This is a problem for the Combinations.rank() code, which makes many repeated calls to binomial. Might this be related to how binomial is evaluated using GiNaC? Similar problems occur when replacing binomial with log. Weirdly, the code above with fixed parameters for binomial does not create a problem when run in the notebook. However, if different random values are used in the binomial code for each iteration, then the same memory usage occurs. Perhaps there's some sort of caching going on? I've tried this code on both Sage 4.0.1 and Sage 4.1, and the behavior is the same. Thanks for any insights! Stephen --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---