I had an error like this and it turned out to be caused by a GC  
error. Specifically, an object A was allocated, then erroneously  
deallocated (but there was still stuff pointing to it). Object B was  
then allocated, with memory overlapping that of object A. Object A  
was then modified, and that modified the refcount field of object B.  
That might be a variant of what's going on here.

I tracked it down by using gdb's watch command on the object with the  
weird ref count...

- Robert


On Oct 30, 2007, at 12:19 AM, mabshoff wrote:

>>> As I wrote above: The issues with the refcount going insane is a  
>>> nice
>>> result from the debugging and that will hopefully lead to some
>>> improvements in our fight against memleaks.
>>
>> Thanks and good luck,
>
> Carl had some interesting input:
>
> [02:03] <cwitty> I was looking at those refcounts some more.
> [02:03] <mabshoff> ok
> [02:03] <cwitty> It turns out that Python caches and shares small int
> objects:
> [02:04] <cwitty> sage: a = int(0)
> [02:04] <cwitty> sage: sys.getrefcount(a)
> [02:04] <cwitty> 6288
> [02:04] <cwitty> sage: b = int(0)
> [02:04] <cwitty> sage: sys.getrefcount(a)
> [02:04] <cwitty> 6289
> [02:04] <cwitty> sage: a is b
> [02:04] <cwitty> True
> [02:04] <mabshoff> ok
> [02:04] <cwitty> So the reference-counting problem could be anywhere
> that deals with small Python ints.
> [02:05] <mabshoff> mmmh.
> [02:05] <mabshoff> So it is not the list [0], but the smallint 0 that
> has the reference counter overflow?
> [02:06] <cwitty> Let me go look at your printouts again.  I thought
> so, but I didn't look closely.
> [02:06] <cwitty> Yeah, that's what it looks like to me.  (Just judging
> from your next-to-latest e-mail.)
> [02:07] <mabshoff> Because the numbers "jump", while I would expect
> them to increase by 1 each time.
> [02:11] <cwitty> So it looks like between your first and second
> printouts, the refcount for "0" jumped by 135, and the refcount for
> "1" jumped by at least 125 (to make it wrap).
> [02:11] <mabshoff> Yep, otherwise it would take *forever* to even wrap
> on a 32 bit box.
>
> So now comes the question: Why doesn't the refcount get decremented?
> How do we fix this?
>
>>
>> Jaap
>
> Cheers,
>
> Michael
>
>
> 

--~--~---------~--~----~------------~-------~--~----~
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://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to