[gt-users] memory leak in create_from_ptr

Sascha Steinbiss steinbiss at zbh.uni-hamburg.de
Tue Apr 7 12:10:01 CEST 2009


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.

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



More information about the gt-users mailing list