For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > April 2004 > Re: Text::Undo memory leak problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Text::Undo memory leak problem
Brian McGonigle

2004-04-08, 8:42 am

What about $textundo->ResetUndo ?

zentara wrote:
> Hi,
>
> There was a recent discussion of memory leaks in Tk, and
> I went and checked an app I was working on. Whoa!!! Talk about
> leaking!!!!
>
> So I spent sometime to track down what was happening and found out
> I was leaving alot of Tk::Photo objects laying around, and rewrote
> everything to delete them.
>
> I still found 1 tricky and hard to find leak, and it is due to using
> Text::Undo instead of plain Text. It seemed that everytime I loaded
> some data into the Text::Undo widget, and then unloaded it, I was saving
> some sort of "undo information" even if nothing changed in the text.
>
> So, no problem, I just went back to Text.
>
> But I was wondering if there is a way to "delete the undo information"
> only, when I unload the text data, so that the Undo widget will act
> like the plain text widget upon saving?
>
> Does this make sense to anybody?
>
> What made me think about this was a trick I saw Merlyn use with
> a Image::Magick object, where he would "clean out" an object without
> destroying it, like:
>
> my $im = Image::Magick->new;
>
> #start loop
> #use $im in a loop many times
> undef @$im; #clean out object for next use
> end loop
>
> So is there a way to "Clean out the Text::Undo widget" for use
> in a repeated loop?
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> I'm not really a human, but I play one on earth.
> http://zentara.net/japh.html


zentara

2004-04-09, 8:33 am

On Thu, 08 Apr 2004 11:39:02 GMT, Brian McGonigle
<brian.mcgonigle@verizon.net> wrote:

>What about $textundo->ResetUndo ?


Yes, you are right. Thanks for reminding me.


--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com