CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Question about deleting a TK object by exiting a routine?

 



cptkrf
New User

Jul 13, 2012, 7:23 PM

Post #1 of 1 (1711 views)
Question about deleting a TK object by exiting a routine? Can't Post

After chasing down leaks in Perl Tk over the years and not thinking much about it, I was hunting down a different bug and realized that I had defined a button in a subroutine and it was going undef on the return. No problem there - normal action and my screwup.

But, it suddenly occurred to me that instead of going though all the problems of keeping up with and deleting the image objects in TK (and TK loves to leak memory from the IMAGE widget), a simple fix for a simple program would be to display the image on a button in a subroutine and let it undef almost immediately. The image stays on the screen until it is overlaid, so the visual part works fine. Of course, the button doesn't exist anymore so code can't be executed from it.

But... Looking at memory with a heap examiner, I am getting the feeling that the object might be evaporating from view and use, but not getting destroyed. I don't see how it couldn't be, since it was created in a subroutine and all the other variables vanish.

Thoughts, anyone?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives