Hi Titus,
I'll enumerate the various mechanisms that involve some form of  
caching.  As you'll see, virtually all of them only reference the  
string ID of a sequence, not the sequence object itself.

SequenceFileDB:
- _weakValueDict has seq ID as key, seq object as associated value.   
But you called clear_cache(), so that reference should be eliminated.   
You could check that by printing len(db._weakValueDict) and  
len(db._weakValueDict._keepDict)

- _cache: this caches *strings* representing slice(s) of sequence.  It  
does NOT hold a reference to the sequence object.  This mechanism is  
controlled by cacheMax, which sets the maximum length for any string  
to be cached.  This isn't relevant to your refcount problem.

- seqInfoDict: this only uses IDs.  It holds no references to sequence  
objects.

NLMSA:
- seqs: this nlmsa_utils.NLMSASeqDict object uses a dict for fast  
lookup of sequence objects to find their internal IDs, and thus holds  
a reference to your sequence object.  However, when you delete the al  
object, Pyrex should automatically release the reference to the  
al.seqs attribute, causing it to be garbage collected as well.  You  
could check that by adding a __del__() method to this class that just  
prints an "I am deleted" message.  FYI, its seqIDdict and IDdict  
attributes store mappings between external sequence IDs and internal  
NLMSA IDs.  Neither of these hold sequence object references, only IDs.

- seqlist: stores a list of the NLMSASequence indexes.  None of these  
hold references to any sequence objects.

- seqDict: typically this is a PrefixUnionDict, which simply maps  
string prefixes to sequence database objects.  It does not hold any  
sequence object references.  In your case, you are implicitly making  
it use SeqPrefixUnionDict, whose behavior is almost the same.  The  
only case where this could hold a reference to the sequence object is  
if the sequence had no "db" attribute.  But in your case it must have  
a db attribute (it is from a SequenceFileDB), so SeqPrefixUnionDict  
will hold no sequence object reference.  You can check this by seeing  
if 'user' in al.seqDict.prefixDict; this should be False.  The  
SeqPrefixUnionDict.seqInfoDict again only uses IDs, and holds no  
references to sequence objects.

NLMSASlice: would hold a sequence object reference... but you never  
used NLMSASlice, so it's not relevant to this problem.

nlmsa_utils.BuildMSASlice: you are creating and then immediately  
dropping an instance of this class in your line:

al[seq] += seq

BuildMSASlice holds a reference to the sequence object used as the  
argument to NLMSA.__getitem__().  However, you are not holding a  
reference to the BuildMSASlice, so it must be immediately garbage  
collected.

That's all I can think of now.

-- 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to