<div class="gmail_quote">On 17 May 2012 07:33, Ethan Furman <span dir="ltr"><<a href="mailto:ethan@stoneleaf.us" target="_blank">ethan@stoneleaf.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Just hit a snag:<br>
<br>
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.<br>
</blockquote><div><br></div><div>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?</div>
<div><br></div><div>1. Record is active;</div><div>2. Get reference to record through weak ref;</div><div>3. Record becomes inactive;</div><div>4. Start trying to use the (now inactive) record.</div><div><br></div><div>Tim Delaney</div>
</div>