Update: The test just takes way too much memory for a doctest, I would 
think.

Consider the following:
sage: n = prod(primes_first_n(25))
sage: _ = n.divisors()

This takes a good 3 GB of RAM and it does not appear to be a memory leak 
(the doctest claims this to be the problem on failure). I can call this 
about 20 times and the memory usage always goes back to 13.1 % in my case.

Somewhere half through the function the method figures out that it needs to 
use mpz integers and then it will allocate a lot of memory. Probably the 
memory is pretty messed up at this point, making an allocation of about 700 
MB of continuous memory fail.

Also appending a list in the following part is maybe not very effective:

3147                     # fits_c is False: use mpz integers 
3148                     prev = sorted 
3149                     pn = <Integer>PY_NEW(Integer) 
3150                     mpz_set_ui(pn.value, 1) 
3151                     for ee in range(e): 
3152                         all = sorted 
3153                         sorted = [] 
3154                         tip = 0 
3155                         top = len(all) 
3156                         mpz_mul(pn.value, pn.value, p.value) # pn *= p 
3157                         for a in prev: 
3158                             # apn = a*pn 
3159                             apn = <Integer>PY_NEW(Integer) 
3160                             mpz_mul(apn.value, (<Integer>a).value, pn.
value) 
3161                             while tip < top: 
3162                                 all_tip = <Integer>all[tip] 
3163                                 if mpz_cmp(all_tip.value, apn.value) > 
0: 
3164                                     break 
3165                                 sorted.append(all_tip) 
3166                                 tip += 1 
3167                             sorted.append(apn) 

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to