[gt-users] memory leak in create_from_ptr
Sascha Steinbiss
steinbiss at zbh.uni-hamburg.de
Wed Apr 8 18:13:39 CEST 2009
Brent Pedersen wrote:
> 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)
> ######
Thanks, I have found and fixed the problem. The problem was that on each
FeatureNode creation (even when wrapping identical pointers), a
temporary dict was created as a cache for the attribute iterator, which
led to excessive memory usage. This is now deferred until it is actually
used and then discarded, as is the CFuncType object used to fill it.
I have also introduced a slight interface change to the FeatureNode
class. Please use the FeatureNode.create_new() constructor class method
to create a new feature node instead of the standard constructor. This
made the class much simpler to read and understand. See my 'fixes'
branch ob github for details. Is this ok with you?
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