struggling with memory release using ctypes wrapper

geskerrett at hotmail.com geskerrett at hotmail.com
Tue Nov 7 22:42:16 EST 2006


I was wondering if a ctypes expert could point me in the right
direction.

I am using the wrapper for the "freeimage" library to create multipage
TIFF files from a group of png images.  The images load and save fine,
the problem seems to be that the memory used during the bitmap creation
isn't being released properly until the python program ends and python
exits.

The multipage tiff's are created in a loop (ie, creating 3 tiffs from a
group of 14 png files).  As the loop progresses, the files are built,
but the amount of memory that is used and reported by Windows XP
taskmanager is not released until python program exits at which time
the amount of memory reported is exactly the same as the start of the
processing.

I am using WinXP SP2, Python 2.4.4, ctypes 1.0.1 and the latest
freeimage libarary and wrapper.

My questions is this,
I have scoured the freeimage site and am confident that I am making the
correct calls to the library and in the correct sequence to release the
resources allocated by the freeimage dll.  After each call to unload
the resources, I have checked the return values, and every thing
*seems* ok in this regard.

I have even used the gc module in DEBUG mode and nothing is reported as
uncollectible.

My questions:
Is there some other method to evaluate a running python program to see
what memory is consumed and objects which have this memory allocated??




More information about the Python-list mailing list