logo       

Re: Tk::Dialog memory leak?: msg#00006

Subject: Re: Tk::Dialog memory leak?
On Saturday 15 July 2006 10:56, ReneeB wrote:
> Hi,
>
> Tk::Tree isn't destroyed because it inherits from Tk::Derived not from
> Tk::Widget.
> I'll try to release a new Tk::Tree version today.
>
> ReneeB

Ok, thanks. I'm still confused:

Tk:Tree has: use base qw(Tk::Derived Tk::HList);
Tk::HList has: use base qw(Tk::Widget);

so it shouldn't really matter, right?

Anyway, removing Tk::Tree from the demo doesn't fix it for other widgets (like 
the default button and all the frames of DialogBox), although it is a widget 
based on Tk::Tree I'm actually having in the real app.

>
> Petr Pajas schrieb:
> > Hi,
> >
> > I have a dialog box which I cannot easily reuse, so it is created many
> > times during the application run. After creating it, I can't find a way
> > to destroy it completely even if I explicitly call $d->destroy              
> >                                                     

oh, *and* was missing here 

> > all variables go out of scope. Here is a demo:

-- Petr


> > #!/usr/bin/perl
> > use strict;
> > $|=1;
> > {
> >   use Tk;
> >   use Tk::Tree;
> >
> >   my $mw = MainWindow->new;
> >
> >   *Tk::Widget::DESTROY = sub {
> >     my $w = shift;
> >     print "DESTROYING $w\n";
> >     $w->destroy if ($w->IsWidget);
> >   };
> >
> >   {
> >     for (1..3) {
> >       print "===================================\n";
> >       print "RUN $_\n";
> >       print "===================================\n";
> >       my $d=$mw->DialogBox(-title=> "test",
> >                        -buttons=> ["OK", "Cancel"]);
> >       # only the Cancel button will get destroyed
> >
> >       my $edit1 = $d->HList(); # will get destroyed
> >       my $edit2 = $d->Tree();  # won't get destroyed
> >       $d->destroy;
> >       # will destroy only Tk::Button a Tk::HList
> >       sleep 0.1;
> >     }
> >   }
> >   #  MainLoop;
> > }
> >
> > END {
> >   print "===================================\n";
> >   print "STARTING GLOBAL DESTRUCTION\n";
> >   print "===================================\n";
> >   # will destroy everything else
> > }
> >
> > __END__
> >
> > Is there any way to prevent the leak? Thanks,
> > -- Petr
> > --++**==--++**==--++**==--++**==--++**==--++**==--++**==
> > ptk mailing list
> > ptk@xxxxxxxxxxxxxxxxxx
> > https://mailman.stanford.edu/mailman/listinfo/ptk
--++**==--++**==--++**==--++**==--++**==--++**==--++**==
ptk mailing list
ptk@xxxxxxxxxxxxxxxxxx
https://mailman.stanford.edu/mailman/listinfo/ptk




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qnx.openqnx.dev...    politics.lenini...    audio.emagic.ex...    tex.texinfo.gen...    handhelds.linux...    ietf.sipping/20...    lang.erlang.gen...    cygwin.talk/200...    yellowdog.gener...    mozilla.devel.l...    xfree86.newbie/...    openbsd.ports/2...    db.oracle.devel...    kde.kalyxo.deve...    user-groups.lin...    bbc.cvs/2003-04...    gnu.libtool.bug...    redhat.k12osn/2...    emulators.wine....    freebsd.devel.d...    search.xapian.g...    java.izpack.use...    network.mrtg.us...    windows.total-c...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe