On Sunday, December 30, 2012 2:13:23 AM UTC+1, Nils Bruin wrote:
>
> > > Maybe the problem is with endomorphism rings, because we have the 
> domain 
> > > and codomain pointing to the same parent, that's a nice culprit for a 
> > > superfluous decref. 
>
> I spent some quality time with gdb and this failing doctest. The good 
> news: memory layout is deterministic, so you can just set a "watch" on 
> a memory location and get a break every time that location gets 
> touched. I've analyzed what goes wrong (at least for me) to a certain 
> degree: 
>
> PyMalloc uses pools for fixed sized memory blocks. Unused blocks in a 
> page are linked together in a "freelist". The segfault arises from 
> interpreting a non-pointer value as a pointer value. The "1" that ends 
> up there happens to be a refcount of a string. I got the strong 
> impression that that same block also got allocated as a "tuple", which 
> has a "GC block" in front of it. The 1 should wreak havoc there as 
> well, but apparently never does. It may well be that this block got 
> inserted twice into a freelist and hence gets allocated twice, which 
> later on messes up the memory management. 
>
> Just prior to the activity that I thought looked like a double free, I 
> noticed that this block is indeed used for allocation of 
> sage.categories.modules.Modules.HomCategory.parent_class. This is 
> happening around the doctest 
>
>             sage: from sage.modules.module import Module 
>             sage: M = Module(ZZ); M 
>             sage: M.endomorphism_ring() 
>
> and some free activity afterwards did have weakref.callback stuff in 
> its stack trace. 
>
> I had good hopes that with a --without-pymalloc build, we'd catch a 
> double free like this red handed, but no such luck (I cannot reproduce 
> the problem at all on debug builds).

Me neither, too bad.
At least it got us to have a working Python debug build. 

> My afternoon with gdb has 
> horribly little to show for, but at least my observations seem in line 
> with what JP has found. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.


Reply via email to