At 10:30 AM -0800 2007-11-16, Jeff Hobbs wrote:
>Russell Owen wrote:
>>My application has a nasty memory leak when I use ActiveState Aqua
>>Tcl/Tk 8.4.16. This goes away when I revert to 8.4.11. The leak
>>appears to occur when I display an image on a canvas -- am amount
>>of memory roughly equal to the image size is allocated and never
>>released. Since my application displays guider images as they come
>>in, this causes trouble over a night's observing.
>>
>>I will try to find some time to create a simple tcl/tk script that
>>shows the leak. However, this could take awhile. My application
>>uses Python (2.5.1) and Tkinter and the image is displayed with PIL
>>(1.1.6) and my tcl/tk knowledge is rudimentary.
>>
>>Meanwhile I was wondering if anybody else had seen this and been
>>able to narrow it down?
>
>This has not been reported before, and I think memory leaking on
>canvas images would be noted by others. What features in PIL are
>you using? Is it possible to replicate in pure Tcl?
Here is an extract of the code (the actual code is in RO package
<http://www.astro.washington.edu/owen/ROPackage/Overview.html>
RO/Wdg/GrayImageDispWdg.py) to show how I use PIL:
def _dispFromScaled(self, val):
return val * self.dispScale + self.dispOffset
def applyRange(self):
self.scaledIm = Image.frombuffer(
"F",
subFrameShapeIJ[::-1],
self.scaledArr[self.begIJ[0]:self.endIJ[0],
self.begIJ[1]:self.endIJ[1]].tostring(),
"raw",
"F",
0,
-1,
)
currIm = self.scaledIm.point(self._dispFromScaled)
self.tkIm = ImageTk.PhotoImage(currIm)
self.cnv.create_image(
self.bdWidth, self.bdWidth,
anchor="nw",
image=self.tkIm,
)
When I get a chance I'll try to replicate this in tcl/tk and issue a
proper bug report. At the moment the only thing I'm sure of is that
my application leaks memory leak when using Aqua Tcl/Tk 8.4.16 and
not when using 8.4.11.
-- Russell
|