memory leak wrapping object having _typelib_guid_ attribute
Andrea Babini
andrea.babini at think3.com
Tue May 27 09:29:18 EDT 2003
Hi,
I'm using win32all build 152 on Python 2.2.2 to develope a COM server
that implements an interface defined in a specific typelibrary.
The python class look like the follow:
...
from win32com.server.util import wrap
class PippoCustom:
#
# COM declarations
#
###
### Link to typelib
_typelib_guid_ = '{14784438-DB63-43CA-86C9-5AB373A247E2}'
_typelib_version_ = 1, 0
_com_interfaces_ = ['IPippo']
def newInstance(self):
return wrap(PippoCustom())
I'm experimenting a memory leak each time I call the newInstance
method.
If I modify the newInstance method as follow :
def newInstance(self):
wrap(PippoCustom())
return wrap(PippoCustom())
the leak doubles, so I suppose the leak is caused by the wrap
function.
This leak doesn't appear if the class expose _public_methods_ instead
of implementing a specific interface as it is for PippoDispatch below.
class PippoDispatch:
#
# COM declarations
#
_public_methods_ = ['newInstance']
_public_attrs_ = []
_readonly_attrs_ = []
def newInstance(self):
return wrap(PippoDispatch())
Thanks in advance!
Andrea
More information about the Python-list
mailing list