[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Weak tables and userdata finalization
- From: Mark Hamburg <mark@...>
- Date: Fri, 2 Sep 2011 09:14:10 -0700
On Sep 2, 2011, at 9:06 AM, Mark Hamburg wrote:
> Though does this then get worse? I had assumed that if I had an object that could be queued for finalization on the value side of a weak table, that entry would get cleared in the GC pass so one could recognize such objects by testing an appropriate mapping. For example, our proxy system for Objective-C objects uses a weak table mapping light userdata Objective-C object addresses to Lua proxies so that we generate the same proxy for a userdata object if we need to publish it to Lua multiple times. It would be really bad if we could end up using a proxy that had been scheduled for finalization. Now, I haven't seen this happening, but the above code snippet certainly suggests that it's possible. Please tell me I've missed something as opposed to just being extremely lucky...
I feel better about this case. iscleared does allows for the collection of finalized keys. Whew.
Mark