XP is just a number | |
PerlMonks |
Re: Tk::NoteBook memory usageby zentara (Archbishop) |
on May 10, 2004 at 13:27 UTC ( [id://352042]=note: print w/replies, xml ) | Need Help?? |
You have to be very careful with Tk when you start deleting widgets. The Tk::DynaTabFrame has a nice demo which lets you add and delete notebook tabs. I've monitored the demo and the memory use increases as you add tabs, it holds constant as you delete tabs, and holds constant as you re-add tabs, until you exceed the previous max-tab number, when it starts to increase again. This is just how you would expect it to work. In your particular example, I think you are assuming that when you delete a tab, it disappears completely, and it's "internal tab number" is automatically made available for reuse. I don't believe it acts that way. You seem to be just creating new tabs, up to infinity. I have seen a similar problem with other widgets, specifically the HList, which I have been toying with lately. Say for instance I add 10 entries to the HList, the internal counter of HList numbers them from 0 to 9. Now if I delete them all, and then add 10 new entries, the internal numbering is now 10 to 19, NOT 0 to 9. So you need to learn how to create a set number of widgets, and then reuse them over and over again. I realize it would be easier if you could do it like you want, but it just dosn't work that way. It may have something to do with the TCL underneath perlTk, I am not that much of an internals expert. I have been toying with the idea of testing GTK2-perl for this, and see if it behaves in a similar manner, or whether it has a better internals design. I'm not really a human, but I play one on earth. flash japh
In Section
Seekers of Perl Wisdom
|
|