On Apr 3, 2006, at 3:12 PM, Neil Schemenauer wrote:

> Guido van Rossum <[EMAIL PROTECTED]> wrote:
>> This would require a bit "__del__ already called" on an object,
>> but don't we have a whole word of GC-related flags?
>
> No.

Actually there is. Kinda. Currently python's refcounting scheme uses  
4 words per object (gc_next, gc_prev, gc_refs, ob_refcnt), and has  
one spare word in the padding of PyGC_Head that's just sitting there  
wasting memory. So really it's using up 5 words per object, and that  
5th word could actually be used for flags...

/* GC information is stored BEFORE the object structure. */
typedef union _gc_head {
     struct {
         union _gc_head *gc_next;
         union _gc_head *gc_prev;
         int gc_refs;
     } gc;
     long double dummy;  /* force worst-case alignment */
} PyGC_Head;


#define PyObject_HEAD           \
     _PyObject_HEAD_EXTRA        \
     int ob_refcnt;          \
     struct _typeobject *ob_type;

typedef struct _object {
     PyObject_HEAD
} PyObject;


James
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to