[gt-users] memory leak in create_from_ptr

Brent Pedersen bpederse at gmail.com
Wed Apr 8 16:23:38 CEST 2009


On Tue, Apr 7, 2009 at 3:10 AM, Sascha Steinbiss
<steinbiss at zbh.uni-hamburg.de> wrote:
> Brent Pedersen wrote:
>> hi,
>
> Hi Brent, nice to hear from you again!
>
>> i think that this script (run from root of gt):
>>
>> ###########################################
>> import gt
>>
>> fi = gt.FeatureIndexMemory()
>> fi.add_gff3file("testdata/splice_site_prob.gff3")
>> f = fi.get_features_for_seqid(fi.get_first_seqid())[0]
>>
>> while True:
>>     g = gt.FeatureNode.create_from_ptr(f.gn, newref=True)
>>     #g = gt.GenomeNode.create_from_ptr(f.gn, newref=True)
>>
>> ##############################################
>>
>> shows a memory leak even when run with newref=False.
>> i think maybe it's something with create_from_ptr() or
>> to do with FeatureNode's having attribs that should be freed.
>
> Actually, it's the fact that the Array returned by
> gtlib.gt_feature_index_get_features_for_seqid() is not free'd when the
> results have been collected in a Python array. Thanks for the bug report.
>

hi, here's a simpler test case:

######
import gt
f = gt.FeatureNode('1', 'CDS', 123, 234, '+')
while True:
    g = gt.FeatureNode.create_from_ptr(f.gn, newref=False)
######

> However, I am unsure what you are trying to do there. The
> fi.get_features_for_seqid() call already returns a Python array of
> wrapped FeatureNodes, why are you trying to create new instances this way?
>
>> uncommenting the 2nd line in th while loop shows a bug fixed by
>> the patch below.
>
> Thank you, I will forward the patches soon.
>
>> -brent
>
> Sascha
>
> --
> Sascha Steinbiss
> Center for Bioinformatics
> University of Hamburg
> Bundesstr. 43
> 20146 Hamburg
> Germany
>
> Email:  steinbiss at zbh.uni-hamburg.de
> URL:    http://www.zbh.uni-hamburg.de/steinbiss
> Phone:  +49 (40) 42838 7322
> FAX:    +49 (40) 42838 7312
>
> _______________________________________________
> gt-users mailing list
> gt-users at genometools.org
> http://genometools.org/mailman/listinfo/gt-users
>


More information about the gt-users mailing list