[gt-users] memory leak in create_from_ptr
Brent Pedersen
bpederse at gmail.com
Wed Apr 8 19:13:11 CEST 2009
On Wed, Apr 8, 2009 at 9:13 AM, Sascha Steinbiss
<steinbiss at zbh.uni-hamburg.de> wrote:
> 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?
>
hi, i pulled from there and updated my code. i had used
FeatureNode.attribs dict a lot
so had to change that. also, i prefer the pythonic class construction
rather than create_new()
but everything works so i'll take it.
thanks,
-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