On Dec 9, 10:36 am, Martin Albrecht <[EMAIL PROTECTED]>
wrote:
> Hi there,
Hi Martin,
> I'm trying to understand the following memleak without success. Consider three
> functions:
>
> def f(X):
> try:
> return ZZ(X)
> except TypeError:
> X = ZZ(map(ZZ,X),2)
> return X
>
> def g(X):
> try:
> return ZZ(X)
> except TypeError:
> pass
>
> def h(X):
> X = ZZ(map(ZZ,X),2)
> return X
>
> As you can see below, f leaks:
>
> m = get_memory_usage()
> for i in xrange(10^3):
> _ = f([1,0,1])
> print get_memory_usage() - m
>
> 4.72265625
>
> while g and h are clean:
>
> m = get_memory_usage()
> for i in xrange(10^3):
> _ = g([1,0,1])
> print get_memory_usage() - m
>
> 0.0
>
> m = get_memory_usage()
> for i in xrange(10^3):
> _ = h([1,0,1])
>
> 0.0
>
> So it seems each component of the function is clean but their combination
> leaks. Any ideas?
My guess would be that maybe another coercion is involved when doing
running h. There have been several issues exposed recently where the
new coercion's caching mechanism did not work and subsequently did
start leaking memory. Two examples are #4639 and #4740. The first one
is still open while the second one has a fix that unfortunately causes
one failure in the pickle jar.
Other than that I have no idea yet what specifically can go wrong
here. I assume you ran valgrind on the example?
> Cheers,
> Martin
> --
Cheers,
Michael
> name: Martin Albrecht
> _pgp:http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
> _www:http://www.informatik.uni-bremen.de/~malb
> _jab: [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---