Identity Crisis

Wed 08 October 2003

Well! It turns out that the bsddb conversion was pretty easy after all. (At least, moving object storage to it.) Now all I have to do is track down this stupid identity management issue and I'm all set.

The only problem is that somehow, objects are sometimes being doubly instantiated when they should only be instantiated once, and sometimes they're not being re-instantiated when they should be garbage collected and re-created.

In the particular issue I'm debugging at the moment, the object relationship is SUPPOSED to be:

stack : item
stack : pool : store : weak cache : item

and since the stack is holding a strong reference to the item, it shouldn't go away and be re-created, but somewhere in there there's a mistake.

Is there any common pattern, either for implementing or debugging these kinds of "this object can be garbage collected back to storage but it really only exists once" kind of things?
© Glyph 2015; All Rights Reserved Excepting Those Which Are Not.