That really shouldn't be necessary, there must be a problem with the way
I'm using the WeakKeyDictionary in the canvas cache module.
I'll try to look look at it tonight.
Ian
John Goodfellow wrote:
> Alright, the following code solves the leak:
>
> def Test3(idx):
> logging.debug("GC TRACKING %d OBJECTS" % len(gc.get_objects()))
> area = ui.get_cols_rows()
> txt = Text("THIS IS A TEST STRING %10d" % idx, align="center")
> fill = Filler(txt)
> canvas = fill.render(area)
> ui.draw_screen(area, canvas)
> txt._invalidate()
> sleep(0.50)
>
> The _invalidate() method is called to remove the object from the
> CanvasCache. Once that is done, no leak. But, this is quite tedious if
> there are multi objects which can leak. There must be a better way -
> maybe in a destructor for the widget base?
>
> On Wed, Jun 4, 2008 at 8:44 PM, John Goodfellow <[EMAIL PROTECTED]> wrote:
>> Hi Y'all,
>>
>> I have a long running text mode application (an Asterisk interface) which
>> uses Urwid and Twisted. The library itself performs the functions I require,
>> but I notice over time my little application consumes more and more memory.
>>
>> For my main call list window, I started out using a SimpleListWalker and
>> switched to the default of the ListBox - the PollingListWalker which solved
>> one leak, but then I observed that whenever I opened an additional window,
>> objects accumulated which were not released. The Python version I have tried
>> this on is 2.5.2 and the 2.5 generation from Debian Etch.
>>
>> I attach a sample which demonstrates the problem. Iterating using Test()
>> produces the memory leak as more and more objects are tracked by the garbage
>> collector but don't seem to be returned or collected and are yet not
>> uncollectable. I created an alternative (Test2()) which simply allocates and
>> then pops from a list. At the end of each procedure, the procedure's non
>> externally referenced variables should be disposed, but the objects from
>> Test() persist and grow.
>>
>> I am sure there must be a very simple explanation why this happens. Perhaps
>> someone could explain it.
>>
>> Many thanks.
>>
>>
>
>
> _______________________________________________
> Urwid mailing list
> [email protected]
> http://lists.excess.org/mailman/listinfo/urwid
>
_______________________________________________
Urwid mailing list
[email protected]
http://lists.excess.org/mailman/listinfo/urwid