From: Lisandro D. <da...@gm...> - 2006-10-30 23:05:58
|
On 10/30/06, Fernando Perez <fpe...@gm...> wrote: > On 10/30/06, Charles R Harris <cha...@gm...> wrote: > > > I suspect the real problem is that the refcount keeps going up. Even i= f it > > was unsigned it would eventually wrap to zero and with a bit of luck ge= t > > garbage collected. So probably something isn't decrementing the refcoun= t. > > Oops, my bad: I meant *unsigned long long*, so that the refcount is a > 64-bit object. By the time it wraps around, you'll have run out of > memory long ago. Having 32 bit ref counters can potentially mean you > run out of the counter before you run out of RAM on a system with > sufficient memory. > > Cheers, FYI, this is what is defined in Include/object.h /* PyObject_HEAD defines the initial segment of every PyObject. */ #define PyObject_HEAD=09=09=09\ =09_PyObject_HEAD_EXTRA=09=09\ =09Py_ssize_t ob_refcnt;=09=09\ =09struct _typeobject *ob_type; #define Py_INCREF(op) (=09=09=09=09\ =09_Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA=09\ =09(op)->ob_refcnt++) #define Py_DECREF(op)=09=09=09=09=09\ =09if (_Py_DEC_REFTOTAL _Py_REF_DEBUG_COMMA=09\ =09 --(op)->ob_refcnt !=3D 0)=09=09=09\ =09=09_Py_CHECK_REFCNT(op)=09=09=09\ =09else=09=09=09=09=09=09\ =09=09_Py_Dealloc((PyObject *)(op)) And '_Py_CHECK_REFCNT' macro will finally call Py_FatalError 'ob_refcnt' is a Py_ssize_t integer, so I think you will not be able to overflow it, unless in case of C code with refcounting bugs. Am I right? --=20 Lisandro Dalc=EDn --------------- Centro Internacional de M=E9todos Computacionales en Ingenier=EDa (CIMEC) Instituto de Desarrollo Tecnol=F3gico para la Industria Qu=EDmica (INTEC) Consejo Nacional de Investigaciones Cient=EDficas y T=E9cnicas (CONICET) PTLC - G=FCemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594 |