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.