Re: Memory leak problem in using comtypes
Thomas Heller <theller <at> python.net>
2006-08-04 19:59:55 GMT
Sumeet Sobti schrieb:
>> >
>> > (2) There's one case in which memory still leaks. This is when I
>> call a
>> > method on a COM object, and the COM object returns an answer like
>> this:
>> >
>> > (((127900.0, None, 2620), (127875.0, None, 2335), (127675.0, 1071,
>> > None)), 127800.0)
>> >
>> > That is, when tuples are nested 3 levels deep.
>> >
>> > There is *no* memory leakage when the answer is of the form:
>> >
>> > ((128000.0, None, 2576), (127975.0, None, 1923), (127950.0, None,
>> > 1734))
>> >
>> > That is, when tuples are nested only 2 levels deep.
>>
>> Can you post the IDL of these COM methods?
>>
>
> Both of these cases are from the same method of a COM object. The
> output depends on the input argument I supply to the method. The IDL
> entry is this:
>
> [id(0x00000008), propget, helpstring("property Get")]
> HRESULT Get(
> [in] VARIANT vKey,
> [out, retval] VARIANT* pVal);
>
> The input is a string describing what I want to get out of it. In the
> first case, I ask for 2 items, and it returns a tuple containing the
> two items. In the second case, I ask for only 1 item, and it returns
> just that item.
>
> The entry in the comtypes generated python file looks like this:
>
> COMMETHOD([dispid(8), helpstring(u'property Get'), 'propget'],
> HRESULT, 'Get',
> ( ['in'], VARIANT, 'vKey' ),
> ( ['retval', 'out'], POINTER(VARIANT), 'pVal' )),
>
It seems there is no quick fix for those, but I'm looking into it.
So far, I have added testcases only that show the problem
Thomas
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV