On Aug 10, 2009, at 8:56 AM, C. Titus Brown wrote: > OK, some more details... there seems to be something going on with the > NLMSA.seqs attribute / NLMSASeqDict class. > > -- > > In class NLMSA, the __iadd__ function increases the refcount of > 'self.seqs' by 2. > > However, the only function it calls is 'self.seqs.saveSeq', which only > adds a single refcount.
Yes, all the operations triggered by saveSeq() should not add any lasting references to self.seqs. So that is a puzzling observation. > > This makes me wonder if it is, indeed, a Pyrex bug... If so, then even after the NLMSA object is closed and deleted, Python may still think the NLMSASeqDict object has a non-zero refcount, and thus would fail to garbage-collect it. That could explain why there would still be references to the sequence object, since NLMSASeqDict itself keeps a mapping of sequence objects --> ID information. You could test this idea by calling al.seqs.clear() right after calling al.close(), then see if this reduces the refcount of your sequence object. > > -- > > Another factoid: if you use an in-memory NLMSA (mode=memory), you > don't > have the same buildup of refcounts. Why this difference!? That's a revealing hint. Ordinarily, NLMSASeqDict allocates two shelve objects for storing the sequence ID <--> internal ID mappings. However, in memory mode it switches to using dict for these indexes. > > -- > > Very frustrating to track this stuff down ;). Let me know if I can help. -- Chris --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pygr-dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pygr-dev?hl=en -~----------~----~----~----~------~----~------~--~---
