|
|
| We don't bite newbies here... much | |
| PerlMonks |
My fix for Tk::Animationby TomKane (Beadle) |
| on Jul 07, 2009 at 21:00 UTC ( #778020=perlmeditation: print w/ replies, xml ) | Need Help?? |
|
I was having a serious problem with Tk::Animation because running a series of very large animated gif's (e.g., 100-900Kb) would eventually bog down the system. I presumed that memory references were not being dropped so the memory was accumulating. That was unacceptable for an application I am developing.
I decided that I had not really looked as closely at the Animation.pm file as I should have. Well, I looked at how the animated gif's multiple frames were being managed and discovered that they were being placed into an anonymous array in the object's 'self'-hash. I couldn't find any place where the references were being deleted. So I added a function that pops the reference elements off the array and lets them simply die away. I was then able to open and close multiple animated gifs, far more than I was ever able to do with the previous version of Animation.pm. Here is the function (it seems too simple):
In my application, I call del_frames after I stop using the animated gif and it is available and effective. I hope that this may be useful to others. Tom
Back to
Meditations
|
|
||||||||||||||||||||||||