[python-win32] membuf and memory leaks

Larry Bates lbates@syscononline.com
Tue, 10 Sep 2002 08:22:11 -0500


I've recently been using Sam Rushing's calldll/membuf 
functions to interface to several .DLL based toolkits.
It has taken quite a bit of digging to get these working
properly, but I finally have them working to my satisfaction.

Today it occurred to me that while I'm allocating memory buffers
in my class interface to the .DLL, I'm never releasing them.
I'm concerned that over time I will be leaking memory to 
every function call that must allocate a membuf.  I'm not 
a C-programmer, but I looked over the source code to membuf
function and there appears to be code there for deallocation
of memory buffer (membuf_object_deallocate), but no entry 
point to it in the membuf_object_methods list to access it.
Can anyone shed some light on proper method for destroying
membuf instances after they are no longer required so that
I don't have a memory leak?

Thanks in advance for any assistance.

Regards,
Larry Bates
Syscon, Inc.