On 17 May 2012 07:33, Ethan Furman <et...@stoneleaf.us> wrote:

> Just hit a snag:
>
> In cPython the deterministic garbage collection allows me a particular
> optimization when retrieving records from a dbf file -- namely, by using
> weakrefs I can tell if the record is still in memory and active, and if so
> not hit the disk to get the data;  with PyPy (and probably the others) this
> doesn't work because the record may still be around even when it is no
> longer active because it hasn't been garbage collected yet.
>

What is the distinguishing feature of an "active" record? What is the
problem if you get back a reference to an inactive record? And if there is
indeed a problem, don't you already have a race condition on CPython?

1. Record is active;
2. Get reference to record through weak ref;
3. Record becomes inactive;
4. Start trying to use the (now inactive) record.

Tim Delaney
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to