A couple garbage collector questions

Ben Hutchings ben.hutchings at roundpoint.com
Thu Apr 5 21:28:42 EDT 2001


"Scottie" <me at nospam.net> writes:

> "Tim Peters" <tim.one at home.com> wrote in message
> news:mailman.986419387.4136.python-list at python.org...
> >...Sure, depending on the size of the integer.  But Python uses C's "int"
> type
> > for refcounts, and offhand I don't know of any platform on which read or
> > write of a C int is interruptible....
> 
> a non=naturally aligned int may straddle a page boundary, and a
> page fault on half of the store might happen.
<snip>

It takes effort to make a C compiler use non-naturally-aligned ints.
Simple *write* operations on a basic machine type (which the int type
should be) should be atomic, but reference-counting shared objects
requires atomic read-modify-write operations, and in some processor
architectures those can be very expensive.

-- 
Any opinions expressed are my own and not necessarily those of Roundpoint.



More information about the Python-list mailing list